0

I have a working user-preferences screen which is defined in user_prefs.xml. The xml is enclosed in a PreferenceScreen tag. That all makes sense...

But I need to save other data which the user will not edit. So I thought I'd create a settings.xml for this. But since I'll never need a PreferencesActivity to allow a user to edit these settings, it doesn't seem like using PreferenceScreen makes sense.

For example, I want to store the GeoPoint at the center of a MapView before the app is killed so I can return to that location the next time the app is started.

So is SharedPreferences still the/a right way to go to store data like this? If so, can someone provide an example of the xml file that would store a GeoPoint (or that would store a pair of ints that would define the GeoPoint)?

Many thanks!

Hap
  • 556
  • 1
  • 6
  • 20

1 Answers1

1

If the user isn't going to be accessing this information you probably do not need to create a new xml for the information. It is likely easier to create a new SharePreferences object, in the OnStop() method of your main activity, that stores the GeoPoint information.

Woodsy
  • 3,177
  • 2
  • 26
  • 50