1, Sharedperferences Save the data is mainly similar to the configuration information Format data, so it is mainly stored data is a simple type of key-value, sharedpreferences itself does not have the ability to write data, Instead of Sharedpreferences's internal interface, Sharedpreferences calls the edit () method to get the editor object that he corresponds to, and editor provides many ways to manipulate the data:
(1), Sharedpreferences.editor Clear (): empty all the data inside the sharedpreferences;
(2) SharedPreferences.Editor.putXX: A value corresponding to the specified key is deposited into the sharedpreferences, where xx is the basic type of data deposited;
(3) SharedPreferences.Editor.remove (String key): Delete the item that corresponds to the key specified in the sharedpreferences;
(5) Boolean commit () The method is called when editor is completed to commit the modification.
2. Sharedpreferences. itself is an interface, the program cannot directly create Sharedpreferences. instance, only the get sharedpreferences provided by the context. (String name, int Mode) method to obtain sharedpreferences. Instances where the mode can be obtained with the following values:
Context.mode_private: The specified sharedpreferences data can only be read and written by the program itself;
Context.mode_world_private: Specifies that the sharedpreferences data can be read by other programs but cannot be written;
Context.mode_world_writeable: Specifies that the sharedpreferences data can be read and written by other applications
Original address:
http://blog.csdn.net/liu1028701143/article/details/7085088
Go Android sharedpreferences Use