I ran into a strange problem today : I have 3 activites : A, B and C.
A starts B then finishes. B starts C then finishes. C is the only one running. And guess what happens when I call finish()
on C (I have an exit app button) ? B is automatically created
So I did something : on B's onStart
, if a certain static flag is set up, B call finish
on itself. And what happened ? A was automatically created !
I finally got around that by calling finish()
on A's start too if the flag is set but this was somehow a nightmare.
NB : I was 100% sure that C was the only one running when I pressed the exit button, thanks to logs on onDestroy()
etc. I was also sure that there was no thread / timer running in the background etc. The proof is that A was magically created when I forced killed B, but was not created before.
NB 2 : I know the exit button is not the good thing on Android but the app is running in a kiosk on a special hardware support and users don't have access to home button and back arrow etc, hence the exit button in the admin part of the app
Edit :
// B.java:
xxx.onClick() { startActivityForIntent(B.this, C.class); finish();}
// same for A.java with B
// C.java exit.onClick { finish(); }
A is the entry point activity of the app