开发者

Check if a login and a password is already in Preferences

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜