1. Download our Official Android App: Forums for Android!

Apps how to store application configuration asks a Newbia

Discussion in 'Android Development' started by horatio, Mar 5, 2010.

  1. horatio

    horatio Newbie
    Thread Starter
    15

    Feb 28, 2010
    17
    0
    15
    Software Engineer
    Dublin
    Hi All,

    New to Android! Can anyone tell me the best way to store application configuration? I want to store items such as URLs and so on. I'm thinking of using Apache Commons configuration but that would mean bundling those jars with my application. Is there a native Android way to do this?

    Thanks,
    John.
     

    Advertisement

  2. KlaymenDK

    KlaymenDK Android Expert
    143

    May 29, 2009
    1,217
    130
    143
    Denmark
    Use the official docs. :)

    Specifically, you want to look at Preferences (if I understand your question correctly).
     
    horatio likes this.
  3. horatio

    horatio Newbie
    Thread Starter
    15

    Feb 28, 2010
    17
    0
    15
    Software Engineer
    Dublin
    Thanks KlaymenDK. That's not quite what I'm looking for however. I want to store application configuration that is never presented to the user. My application will need to make periodic calls to a RESTful web service and I need to store the URL some place that my app can read on initialisation. This shouldn't be presented to the user to change. Is there something like the Windows registry or INI files available for example?

    Cheers,
    John.
     
  4. KlaymenDK

    KlaymenDK Android Expert
    143

    May 29, 2009
    1,217
    130
    143
    Denmark
    Okay, I misunderstood you, then.

    There is no global registry; the prefs system is explicitly intended to store app-specific tidbits; you can use it for storing stuff (say, internal state information) without ever interfacing the user. Or, you could look into the "instance states" discussed here (although data stored this way won't survive a reboot).

    I had better info but I can't find the links right now! :eek:
     
  5. horatio

    horatio Newbie
    Thread Starter
    15

    Feb 28, 2010
    17
    0
    15
    Software Engineer
    Dublin

Share This Page

Loading...