tags:

views:

50

answers:

2

Hi, I like to save very simple a few Data. best like in iPhone I can do with NSUserDefaults.

What is the similar command here in Android? (just saving a few Variables, to be reused as long the application is installed) I dont like to use a complicated Database just to do that.

thx chris

+1  A: 

http://www.kaloer.com/android-preferences

Aaron Saunders
thanks... but its not really what i was looking for.. also your answer will be useful for another project of mine :)
christian Muller
+1  A: 

This is the most simple solution i found:

//--Init
int myvar = 12;


//--SAVE Data
SharedPreferences preferences = getPreferences(MODE_PRIVATE);  
SharedPreferences.Editor editor = preferences.edit();
editor.putInt("var1", myvar);
editor.commit();


//--READ data       
myvar = preferences.getInt("var1", 0);  

greets chris

christian Muller
@Chris this is the way to go for storing very simple things, its simple and straight to the point
smith324