`

Preferences

 
阅读更多
public class Preferences {
	private String CONFIG_NAME = "pref";
	private SharedPreferences spf;
	private Editor editor;
	private Context mContext;
	
	public Preferences(Context context) {
		this.mContext = context;
		spf = context.getSharedPreferences(CONFIG_NAME, 0);
		editor= spf.edit();
	}
	
	public boolean getShowData(){
		return spf.getBoolean("show_data", false);
	}
	
	public void setShowData(boolean b){
		editor.putBoolean("show_data", b);
		editor.commit();
	}
}

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics