开发者

clear values on exit in android

i have some static integer variables in my android application.I am testing the application in emulator.When i click back and return to homescreen and launch the application again, the prev开发者_如何学编程ious values still persist and new values are added to it instead of overriding.So what is the procedure to clear these values when i close the application. I have tried with onRestart() and onStop() methods and reset the counter but it dint work.

How do i overcome this issue


In the onResume() you can call an init() method, for example :

void init()
{
myStaticVar = 0;
//...
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜