本文介绍了共享preference和清除历史记录/数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用共享的preference在Android的本地存储设备上的数据的应用程序(直到应用程序卸载)的一生中,有当用户选择为清除数据,从机器人的失去它的危险 - >菜单 - >设置 - >管理应用程序>清除数据。请指教,谢谢。

If I use sharedpreference in android to store the data locally on a device for lifetime of application (until app is uninstalled), is there a risk of losing it when user opts to "clear data" from android's -> menu-> settings->manage applications>clear data. Please advise, thanks.

推荐答案

没有失去任何东西存储这样的风险。有一个100%的保证,如果用户presses清除数据按钮,为您的应用这些数据将被删除。如果你需要的数据,能够挺过这个(或通过卸载),你需要将其存储在SD卡上。不要轻易作出这个决定,虽然用户可能不会AP preciate您,即使他们清除数据的存储设备上的数据或卸载你的应用程序的事实。

There is not a "risk" of losing anything stored this way. There is a 100% guarantee that this data will be erased if the user presses the "clear data" button for your application. If you need data to persist through this (or through an uninstall) you'll need to store it on the SD card. Do not make this decision lightly though users will likely not appreciate the fact that you are storing data on their device even after they "clear data" or uninstall your app.

这篇关于共享preference和清除历史记录/数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-04 14:19
查看更多