本文介绍了把密码在Android类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我一直在短信应用程序,我想为用户提供...如果用户输入正确的用户名和密码只能访问...我怎么能完成一些私人空间... 。?有人告诉我,我可以使用的AccountManager
但我怎么能与挂靠我的课或活动
关于这一点我很打算把密码....
i have been working on an sms application and i want to provide some private space for the user... which can only be accessed if the user enters the right username and password...how can i accomplish that....? somebody told me that i can use the AccountManager
but how can i link it with my class or activity
on which i am going to put the password....
public class PrivateSpace extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
任何帮助将AP preciated ...
any help will be appreciated...
推荐答案
我认为它可以通过使用共享preferences ..存储密码为您的应用这样可以轻松实现。
I think it can be easily achieved by using shared preferences.. to store the password for your application like this..
SharedPreferences settings = getSharedPreferences("my_shared_pref", 0);
String password = settings.getString("password", "empty");
if(password == "empty"){
//store the value in your edittext as password
}
else{
//if string in edittext matches with the password value.. let the user enter the activity.. else make a toast of wrong password..
}
这篇关于把密码在Android类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!