variables retaining values after app close

前端 未结 6 639
情歌与酒
情歌与酒 2021-01-28 11:23

My app is retaining all of the variable values when it closes and this is effecting how it runs when reopened. Is there any way to reset them all upon app close? or is there a w

6条回答
  •  礼貌的吻别
    2021-01-28 11:59

    Override the onPause, onResume, and onDestroy methods. onPause should save anything upon pausing, onResume should reload these values when it is resumed, and onDestroy will be called when your app closes. You can clean up stuff in onDestroy. See this link.

提交回复
热议问题