android 配置文件

import android.content.Context;
import android.content.SharedPreferences;

public class SharedPreferencesHelper {

SharedPreferences sp;
SharedPreferences.Editor editor;

Context context;

public SharedPreferencesHelper(Context c,String name){
context = c;
sp = context.getSharedPreferences(name, 0);
editor = sp.edit();
}

public void putValue(String key, String value){
editor = sp.edit();
editor.putString(key, value);
editor.commit();
}

public String getValue(String key){
return sp.getString(key, null);
}
}

http://blog.sina.com.cn/s/blog_5da93c8f0100txue.html

posted @ 2011-11-22 10:21  meieiem  阅读(349)  评论(0编辑  收藏  举报