Sharedpreferences is the easiest data storage technology to understand in Android, and in fact sharedpreferences is dealing with a key-value (key-value pair) Sharedpreferences used to store some lightweight data.
Writing data to sharedpreferences
1. Get Sharedpreferences object using Getsharedpreferences (FileName, Mode_private)
2, through the Sharedpreferences object to obtain sharedpreferences. Editor Object
3, through sharedpreferences. editor stores data as key-value pairs
4, call sharedpreferences. editor commit () commits the stored data.
read from sharedpreferences data
1, using getsharedpreferences (FileName, mode_private) get sharedpreferences object
2, using sharedpreferences.getstring (" name "," ") to get the value of the second parameter is the default value
Sample code http://download.csdn.net/detail/wangdianyong/8542157 click the Open link
Regain Android's sharedpeferences operation