shared preference and clear history/data
If I use sharedpreference in a开发者_如何转开发ndroid 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.
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.
精彩评论