1. Use preferenceactivity.
This method is mainly used in setting and a large number of APK setting options.
It is best to define some public static methods in this setting for other objects. The parameter is context.
For example, in other objects, use setting. getabc (getcontext () to obtain the value of ABC.
2. sharedpreferces method,
Use getpreferces (mode_private). Edit (). putstring (ABC, STR). Commit (); To store
Use getpreferces (mode_private). getstring (ABC, STR );
3. instance status bundle, but can only store small information blocks, such as the cursor position.
Onsaveinstancestate ()
Onrestoreinstancestate (parcelable state)
4. properties, which stores a total of hashmaps.
Properties Properties = new properties ();
Try {
Fileinputstream S = new fileinputstream (config_file );
Properties. load (s );
} Catch (exception e ){
E. printstacktrace ();
}
Return properties;
Try {
Fileoutputstream S = new fileoutputstream (config_file, false );
Properties. Store (S ,"");
} Catch (exception e ){
E. printstacktrace ();
}