gpt4 book ai didi

android - 检查登录名和密码是否已在首选项中

转载 作者:太空宇宙 更新时间:2023-11-03 12:24:22 25 4
gpt4 key购买 nike

我看到了一些自动登录的教程,例如这个 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/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com