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"
}
精彩评论