cmnewfan
cmnewfan

Reputation: 129

How to save my app state when android system kill the app?

I know that onPause, onStop and onSavedInstanceData will be called when home button pressed, but how do i know when android system kill my app or destroy it in task manager?

Upvotes: 0

Views: 1492

Answers (1)

Arpit Ratan
Arpit Ratan

Reputation: 3026

Please note that when we press back button i.e., ourself close the activity then onSaveInstance() is not called.

Whenever android system destroy your activity because of low memory conditions onSaveInstance and then onRestoreInstance is called when it is recreated. Hence you should save the state in onSaveInstance.

Upvotes: 3

Related Questions