如何留住全球variebles时,应用程序升级到新版本的Android? [英] How to retain the global variebles when application is upgraded to new version in android?
问题描述
在我的Android应用程序,用户可以通过同意给他们的电子邮件ID的条款和条件进行注册。如果用户升级应用程序到下一个版本,我不应该得到该协议页面或电子邮件注册窗口。我控制它使用全局变量,但如果用户升级应用程序到更新的版本,全局变量得到重置,因此用户再次获得该协议页面,注册窗口。所以,我该怎么办呢?感谢您的帮助提前。
In my android application ,user has to register by agreeing the terms and condition giving their email id. If user upgrade the application to next version, I should not get the agreement page or email registration window. I am controlling it using global variables but if user upgrade application to newer version, global variables get reset, so user get the agreement page and registration window again. So how can I do this? Thanks for help in advance.
推荐答案
您有两种方法来存储数据@当地的媒体。
You Have two ways to storing your data @ local media.
-
共享preference
-
SQLite数据库
Shared Preference
SQLite Database
什么时候应该使用共享preference?
如果你的存储变量的数量并不多,它应该是原始值,那么你可以使用共享preference
。
If your number of storing variable are not more and it should be primitive values then you can use Shared Preference
.
请参阅这样品$ C $℃。
See This for sample code .
或
什么时候应该使用SQLite数据库?
如果你需要存储变量的数量,哪些不是原始的,你也需要一个长时间的数据,那么你应该使用 SQLite数据库
。
If you have to store number of variable and which are not primitive and also you need that data for long time then you should use SQLite Database
.
请参阅这样品code。
现在它的 你要看按您的要求。
Now its Depends on you as per your requirement.
这篇关于如何留住全球variebles时,应用程序升级到新版本的Android?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!