Reference: http://blog.csdn.net/liuyiming_/article/details/7704923
Sharedpreferences Introduction:
Sharedpreferences is a lightweight storage class on the Android platform, mainly to save some common configuration parameters, it is the use of XML files to store data, files stored in the "/data/data<package name>/shared _prefs "directory.
Usage of sharedpreferences:
Since Sharedpreferences is an interface, it does not provide the ability to write data and read data in this interface. But it is through some of the methods in its editor interface to operate the Sharedpreference, the usage is shown in the following code:
Context.getsharedpreferences (String name,int mode) to get a sharedpreferences instance
Name: Refers to the file name, does not need to add the suffix. XML, the system will be added to us automatically.
Mode: is the specified read and write mode, the value of three kinds, respectively:
Context.mode_private: Specifies that the sharedpreferences data can only be read and written by this application
Context.mode_world_readable: Specifies that the sharedpreferences data can be read by other applications but cannot be written
Context.mode_world_writeable: Specifies that the sharedpreferences data can be read and written by other applications.