variables retaining values after app close

前端 未结 6 647
情歌与酒
情歌与酒 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条回答
  •  梦毁少年i
    2021-01-28 12:02

    the onResume() method will let you reset the variables when the program resumes, but will also do it when you return to the activity unless you add the logic that says you are coming from in the app, not the home page. Maybe onRestart() is what you really need? I'm not positive, but it's possible with onResume.

提交回复
热议问题