开发者

Does static variable retains value even when android application is closed

I am developing an android application using bluetooth. When I launch my application for first time, my application works well, but when I exit the application and run it once again I get problems with bluetooth connectivity.

I am not able to establish connection with another device.I am using few critical static variables. My doubt is does these static variables retains the value even when application is exited.

Also i notice that 开发者_开发技巧my application is still running i mean its not stopped. Should we stop the application explicitly when we exit? If so ,how to do that. I am simply using finish when i exit the application.


yaa it will retain value. because application once started does not get killed immediately. but you can not rely on this, because some time android os may kill long inactive processes to release memory. in this case you can loose your data.


yes, static variable will be still in its memory. You can check upon your exit of app, clear out all the static fields declared

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜