Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why android app gets restarted if we use the back button to exit?

Tags:

android

While holding the home button and getting back the app, the app is not restarted. Why it is restarted if we use the back button? Any way to solve by getting the application without restarting if we use back button to exit? Please help

like image 248
indira Avatar asked Mar 09 '11 11:03

indira


1 Answers

When you press the Home button, the application is paused and the current state is saved, and finally the application is frozen in whatever state it is. After this, when you start the app, it is resumed from the last point it was saved with.

However, when you use the Back button, you keep traversing back in the activity stack, closing one activity after another. in the end, when you close the first activity that you opened, your application exits. This is why whenever you close your application like this, it gets restarted when you open it again.

As of now, I don't think any built-in method is there to let you do exactly what Home button does.

like image 123
Aman Alam Avatar answered Nov 15 '22 05:11

Aman Alam