Check for username and password in settings

I saw several guides for automatic login, for example, a link , but when I first use the application, how can I check if the login and password have already been inserted into the "Settings" function? What condition should I put?

+3
source share
1 answer
SharedPreferences sp=PreferenceManager.
               getDefaultSharedPreferences(context);
if(sp.contains("Username")){
//login  exists assuming you are saving the username to a preference with the name "Username"
}
+7
source

All Articles