Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SharedPreferences sp = context.getSharedPreferences("loginSaved", Context.MODE_PRIVATE);
- SharedPreferences.Editor editor = sp.edit();
- editor.putString("username", "some user value");
- editor.putString("password", "some password value");
- editor.commit();
- SharedPreferences sp = context.getSharedPreferences("loginSaved", Context.MODE_PRIVATE);
- String username = sp.getString("username", null);
- String password = sp.getString("password", null);
- if(username != null && password != null){
- // login automatically with username and password
- }
- else{
- // login for the first time
- }
Add Comment
Please, Sign In to add comment