我看到了一些自动登录的教程,例如这个 link ,但是当我第一次使用该应用程序时,如何检查登录名和密码是否已经插入到首选项 Activity 中? 我应该放什么条件?
最佳答案
SharedPreferences sp=PreferenceManager.
getDefaultSharedPreferences(context);
if(sp.contains("Username")){
//login exists assuming you are saving the username to a preference with the name "Username"
}
关于android - 检查登录名和密码是否已在首选项中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6270615/