//创建对象,文件名userInfo,模式MODE_PRIVATE
SharedPreferences session_pref= getSharedPreferences("userinfo",MODE_PRIVATE);
//获取sharedPreferences的editor
SharedPreferences.Editor session_editor=session_pref.edit();
///保存数据
editor.putString("username", username.getText().toString());
editor.putString("password", password.getText().toString());
editor.putBoolean("remember",remember.isChecked());
//提交数据
session_editor.commit();
//获取登录数据
SharedPreferences pref = getSharedPreferences("userinfo", MODE_PRIVATE);
pref.getString("username","")
pref.getString("password","")