On Thu, Mar 25, 2010 at 7:16 AM, Mark Murphy <[email protected]>wrote:
> AFAIK, you can read the SharedPreferences as an XML file. The dangerous > part is that you will probably have to hand-assemble the path to the > file, as I don't recall an API to get the path for a SharedPreferences > file from the SharedPreferences object. > Yup, I've done this for my app so users can backup preferences if they swap phone or upgrade from the free version. Something like this: String packageName = context.getPackageName(); String settingsPath = "/data/data/" + packageName; settingsPath += "/shared_prefs/" + packageName + "_preferences.xml"; Then just load that as an XML file to get all the preferences. You'll have to extract each type (float, int, string, etc.) manually to update the SharedPreferences (unless someone has a better idea...), but there's only a few of them so it's not that bad. On Thu, Mar 25, 2010 at 5:52 AM, Csenteri Barna <[email protected]> wrote: > Another question is that there is any XML parser which has the same > functionality like SharedPreferences (getstring/addstring, getint/ > addaddint etc.) and saves/loads the result to a path anywhere? (sdcard > for example) > Not that I know of, but it's not that hard to do on your own, given the limited number of supported types you can store in the SharedPreferences object. ------------------------------------------------------------------------------------------------- TreKing - Chicago transit tracking app for Android-powered devices http://sites.google.com/site/rezmobileapps/treking -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en To unsubscribe from this group, send email to android-developers+unsubscribegooglegroups.com or reply to this email with the words "REMOVE ME" as the subject.

