开发者

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

开发者 https://www.devze.com 2023-02-15 14:19 出处:网络
While holding the home button and getting back the app, the app is not restarted. Why it is restarted if we use t开发者_开发问答he back button? Any way to solve by getting the application without rest

While holding the home button and getting back the app, the app is not restarted. Why it is restarted if we use t开发者_开发问答he back button? Any way to solve by getting the application without restarting if we use back button to exit? Please help


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消