简体   繁体   English

Android:以偏好设置或SQLite存储

[英]Android: Store in preferences or SQLite

I have to store informations about the user, should I user SQL lite or preferences? 我必须存储有关用户的信息,我应该使用SQL lite还是使用偏好设置?

If I use SQLlite, will the data dissaper when the app is shut down or telefon? 如果我使用SQLlite,则在应用关闭或通话时数据会消失吗? Cause I need them to be saved whenever he opens the app. 因为我每次打开应用程序时都需要保存它们。

If I use SQLlite, will the data dissaper when the app is shut down or telefon? 如果我使用SQLlite,则在应用关闭或通话时数据会消失吗?

No, the data will remain there until the user uninstalls your app or factory resets the phone. 不会,数据将保留在那里,直到用户卸载您的应用程序或将手机恢复出厂设置为止。

If the data is flat/denormalized and in key/value pair format, I would recommend using Shared Preferences . 如果数据是平面/非正规化的,并且为键/值对格式,则建议使用共享首选项

See this article for more information: Android Developers - Data Storage 有关更多信息,请参见本文: Android开发人员-数据存储

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM