In my application, when I press the home button the activity is going to onDestroy()
. It suppose to be called onPause()
method only right?
Why it is happening so?
As we press Home button then first Activity goes in onPause() then onStop().
Some applications will continue to run as a background application, so pressing the home button will not kill them (e.g., Google Play Music will still play after pressing the home button). Your friend might be concerned that by pressing the home button you did not exit the program, and therefore it is still running.
When Android creates and destroys an activity, the activity moves from being launched to running to being destroyed. An activity is running when it's in the foreground of the screen. onCreate() gets called when the activity is first created, and it's where you do your normal activity setup.
also check that you don't use the android:noHistory flag in your manifest for the Activity
documentation: android:noHistory Whether or not the activity should be removed from the activity stack and finished (its finish() method called) when the user navigates away from it and it's no longer visible on screen
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With