1

If pressing the back button calls the onDestroy() method, what method is called when the app is swapped from the recent screen.

How to load the activity that is present in the recent screen, after accidentally pressing the back button?

coder
  • 8,346
  • 16
  • 39
  • 53

1 Answers1

0

Swapping the app from recent screen kills the process. All activities in backstack of that app are destroyed, calling their respective onPause, onStop and onDestroy methods.

Only the user can choose to select and open your app from the recent screen, you cannot programmatically do that, as that would lead to malicious behaviour.

Udit
  • 1,037
  • 6
  • 11
  • I was using the paytm app, when I open the app intially it shows me the logo and takes me to the home page, now when I press the back button, and open the app from the recent screen, instead of showing the logo it takes me to the home page again. Can you explain how is this possible? –  Jul 26 '18 at 19:27
  • I believe you are talking about home button because if you press back button till the time all screens have ended, the logo will show again if you open from recents. Just tried it out myself – Udit Jul 26 '18 at 21:13