package org.mo.common.util.sharepreferences;
import android.content.Context;
import android.content.SharedPreferences;
public class MySharePreferences {
private Context mContext;
private static MySharePreferences mySharePreferences;
public MySharePreferences getInstance(Context mContext) {
if (mySharePreferences == null) {
mySharePreferences = new MySharePreferences(mContext);
}
return mySharePreferences;
}
private MySharePreferences(Context mContext) {
super();
this.mContext = mContext;
}
public SharedPreferences getPrivateSharedpreferences(String name) {
SharedPreferences sharedpreferences = getSharedpreferences(name,
Context.MODE_PRIVATE);
return sharedpreferences;
}
public SharedPreferences getSharedpreferences(String name, int model) {
SharedPreferences sharedPreferences = mContext.getSharedPreferences(
name, model);
return sharedPreferences;
}
}
转载于:https://my.oschina.net/moziqi/blog/364867