简体   繁体   中英

onDestroy() is getting called after onPause()

I am implementing paint Application. My problem is that when i color on object.After some times screen goes to sleep.When i awake the screen, my old paint lost. I find out issue its calling OnDestroy after Onpause automatically so it clears canvas. How to stop calling Ondestroy automatically.

You shouldn't try to circumvent Android's activity workflow and memory management by avoiding onDestroy() (in fact, I think you can't).

Use onSaveInstanceState(Bundle) to store your current state and restore it on onCreate(Bundle) , if a Bundle is provided.

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