aryaxt
aryaxt

Reputation: 77596

Android - Storing information in a configuration manager?

So I'm trying to store some configuration values such as serviceUrl in a file, instead of hard-coding it in my code?

Upvotes: 1

Views: 391

Answers (2)

aryaxt
aryaxt

Reputation: 77596

I ended up using java.util.properties along with AssetManager in andorid to read a properties file from assets directory.

AssetManager: http://developer.android.com/reference/android/content/res/AssetManager.html

Properties: http://docs.oracle.com/javase/tutorial/essential/environment/properties.html

Upvotes: 2

Stefan
Stefan

Reputation: 4705

You should used the SharedPreferences data store to save the configuration data. SharedPreferences support all the atomic Java types for read and write, e.g. String for your service URI.

Here is more information on SharedPreferences and on alternative data stores: http://developer.android.com/guide/topics/data/data-storage.html

Upvotes: 0

Related Questions