简体   繁体   中英

Android access onRestoreInstanceState from onRestart

I am creating an android app with a timer.

When I change orientation, onSavedInstanceState and onRestoreInstanceState are called, which is great. However when I press the home button only onSavedInstanceState is called, but onRestoreInstanceState is not called.

Can I access the saved variables from onRestart or perhaps call onRestoreInstanceState manually, but I don't know how?

You do not see onRestoreInstanceState() called because Android is not restoring you at that moment. You pressed home, so launcher app should be brought to front

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM