04 安卓开发之SharedPreferences存储

1 获取SharedPreferences对象

pre = PreferenceManager.getDefaultSharedPreferences(this);

2 获取editor对象

   editor =pre.edit();

3 保存数据

  editor.putBoolean("isRemeber",true);
  editor.putString("password",password);
  editor.putString("account",account);

4 读取数据

 String account = pre.getString("account", "");
 String password = pre.getString("password", "");

猜你喜欢

转载自blog.csdn.net/weixin_44342753/article/details/106017084
04