Android 配置文件读写
作者:互联网
SharedPreferences preferences = getSharedPreferences("android", Context.MODE_PRIVATE);//"android"为xml文件名
String sGuardTel = preferences.getString("GuardTel", "").toString();//"GuardTel"为字符串字段名
boolean bOpen = preferences.getBoolean("GuardOpen", false);//"GuardOpen"为BOOL字段名
SharedPreferences preferences = getSharedPreferences("android", Context.MODE_PRIVATE);
Editor editor = preferences.edit();
editor.putString("GuardTel", sGuardTel);
editor.putBoolean("GuardOpen", true);
标签:android,配置文件,GuardTel,GuardOpen,editor,SharedPreferences,Android,读写,preferences 来源: https://blog.51cto.com/u_15298588/3034418