android SharedPreferences的用法

http://xusaomaiss.iteye.com/blog/378524

读取:
SharedPreferences sharedata = getSharedPreferences("data", 0);
String data = sharedata.getString("item", null);
Log.v("cola","data="+data);


写入:
String PREFS_NAME = "Note.sample.roiding.com"; 
SharedPreferences settings = getSharedPreferences(PREFS_NAME, 0); 
SharedPreferences.Editor editor = settings.edit(); 
editor.putBoolean("silentMode", true); 
editor.putString("hello", "Hello~"); 
editor.commit(); 

你可能感兴趣的:(android SharedPreferences的用法)