开发者

Check if a login and a password is already in Preferences

开发者 https://www.devze.com 2023-03-11 12:54 出处:网络
I saw some tutorials for auto login for exemple this one link, but when i use the app for the first time, how do i check if the login and password have开发者_开发问答 already been inserted in Preferen

I saw some tutorials for auto login for exemple this one link, but when i use the app for the first time, how do i check if the login and password have开发者_开发问答 already been inserted in Preferences Activity ? What condition should i put ?


SharedPreferences sp=PreferenceManager.
               getDefaultSharedPreferences(context);
if(sp.contains("Username")){
//login  exists assuming you are saving the username to a preference with the name "Username"
}
0

精彩评论

暂无评论...
验证码 换一张
取 消