Android How To I Detect Application Resume from Sleep and Send App to main page -restart
After my application sleeps, when it resumes I don't want it to go back to the last activity it was on but to start fresh from the main activity as a new fresh start. How can this be done? I also want it to be fresh start in terms not just of being on first activivity but also fresh in start in terms of session etc. How can this be done? Where would I detect t开发者_高级运维he resume and how to go back to start. Thanks
Where would I detect the resume and how to go back to start
You could use events OnResume, OnPause etc. I would suggest you simply finish your app when it goes from foreground:
protected void onPause() { //Another activity comes to the foreground or other apps need memory
super.onPause();
SaveSettings(); //Your own method
finish();
}
精彩评论