开发者

Completely close/reset my Android app

开发者 https://www.devze.com 2023-02-15 13:16 出处:网络
I\'ve made an Android app, and in its first view you can select a date from a calendar. Everyt开发者_如何学Ching works fine, but if i push the arrow button on my phone the app seems to close, and i ge

I've made an Android app, and in its first view you can select a date from a calendar. Everyt开发者_如何学Ching works fine, but if i push the arrow button on my phone the app seems to close, and i get back to the home screen of my phone.

However if I restart the app by clicking its icon i can see the splash screen, and after this the first view... where the date i selected b4 closing the app is still selected!

Is there a way to completely clear all the variable of my app?

Thanks


Look at the activity livecycle: http://developer.android.com/reference/android/app/Activity.html

At onResume() you could clear the variables!


Your activity isn't destroyed right away when you hit the back button. If you want all data to be destroyed when someone leaves the app then clear the data out in the onPause() method.

0

精彩评论

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

关注公众号