更新时间:2023-02-16 08:07:39
存储值使用sharepreference.我在这里粘贴代码..使用它.
Store value use sharepreference. i am pasting code here..use it.
创建共享首选项:
SharedPreferences sp=getSharedPreferences("Login", MODE_PRIVATE);
SharedPreferences.Editor Ed=sp.edit();
Ed.putString("Unm",Value );
Ed.putString("Psw",Value);
Ed.commit();
从共享"首选项中获取价值:
SharedPreferences sp1=this.getSharedPreferences("Login", MODE_PRIVATE);
String unm=sp1.getString("Unm", null);
String pass = sp1.getString("Psw", null);
当用户注销时,您可以将null值设置为sharedpreference.
When user logout then you can set null value into sharedpreference.