How to save the state of the only Activity in an Android app when the back button is pressed? -
i'm making app has 1 activity. when press home or recent apps button, state correctly saved , when go app there. when press button , return app later, savedinstancestate null in oncreate. i've read state not saved when button pressed, seems unintuitive in case considering , home buttons equally valid ways leave app in user's eyes, until try , go doing. there no way save state when button pressed?
if must persistent storage, then:
a) how override button behaviour make save app when pressed, and
b) can persistently save bundle somehow don't have duplicate code state saving?
what searching sharedpreferences think take @ it. solving problem
Comments
Post a Comment