Activity is getting destroyed while pressing the home button

It depends on how much memory your phone has, if your phone does not have very much memory, then it will destroy the activity to free up resources immediately. On new phones, this will not happen because they have plenty of spare memory.


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