Home Forum
Welcome, Guest
Username Password: Remember me

Settings persistence
(1 viewing) (1) Guest
Discussion related to creating Android software
  • Page:
  • 1

TOPIC: Settings persistence

Settings persistence 3 years, 5 months ago #65

What's the equivalent of Record Stores in android? I need to save some settings for an application, do I just make a dat file or is there a registry for settings?
  • kryten
  • OFFLINE
  • Freshman
  • Spin my nipple nuts
  • Posts: 8
  • Karma: 0

Re:Settings persistence 3 years, 5 months ago #66

It doesn't matter how you store your data internally. You can use custom data structures and a File Writer/Reader. What does matter is that you present the standard Android interface to other apps wishing to access your data. The term is "Content Provider" and its explained here: code.google.com/android/devel/data/contentproviders.html

Remember to build versioning into your data right from the start

Re:Settings persistence 3 years, 4 months ago #85

Does it need to be exposed at all? If it doesn't then you could use one of these http://code.google.com/android/devel/data.html

You could even store basic data in the Activity's Bundle if it's just whilst the application is closed. Although I'm not sure if it would be lost or not during an extreme use-case such as the battery being ripped out (the methods that are called to insert your data into the Bundle would never be called).

I used SharedPreferences to store a couple of int values which seems to work OK, might be worth a look?

I think the intention was to replace Record Stores with the SQLite databases but I think it's overkill for a few settings/preferences
  • StephenL
  • OFFLINE
  • Freshman
  • Posts: 9
  • Karma: 0
Last Edit: 3 years, 4 months ago by StephenL.
  • Page:
  • 1
Time to create page: 0.17 seconds
Copyright © 2012 Android Academy. All Rights Reserved.
Joomla! is Free Software released under the GNU/GPL License.
 
Glossary
We have 31 guests online