SharedPreferences mySharedPreferences = getSharedPreferences( 
MY_PREFS,Activity.MODE_PRIVATE); 

Shared Preferences are stored within the application's sandbox, so they can 
be shared between an application's components but aren't available to other 
applications. To modify a Shared Preference, use the 
SharedPreferences.Editor class. Get the Editor object by calling edit on 
the Shared Preferences object you want to change. 

SharedPreferences.Editor editor = mySharedPreferences.edit();
 Use the put < type > methods to insert or update the values associated 
with the specified name: // Store new primitive types in the shared 
preferences object. 
editor.putBoolean(" isTrue", true); 
editor.putFloat(" lastFloat", 1f); 
editor.putInt(" wholeNumber", 2); 
editor.putLong(" aNumber", 3l); 
editor.putString(" textEntryValue", "Not Empty"); 
To save edits, call apply or commit on the Editor object to save the 
changes asynchronously or synchronously, respectively. // Commit the 
changes.

Meier, Reto (2012-04-05). Professional Android 4 Application Development 
(Wrox Professional Guides) (Kindle Locations 5914-5928). John Wiley and 
Sons. Kindle Edition. 

On Tuesday, October 2, 2012 5:35:40 AM UTC-5, sree wrote:
>
> hi friends i would like store settings using sharedpreferences in my 
> app,help any one with code.thank you.
>
>

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to