Advertisement
Guest User

Untitled

a guest
Nov 15th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. public static final String MyPREFERENCES = "MisPreferences" ;
  2. public static final String userName = "nombreUsuario";
  3. public static final String userPassword = "passwordUsuario";
  4.  
  5. String username = userName.getText().toString();
  6. String password = passwordUser.getText().toString();
  7.  
  8. SharedPreferences.Editor editor = sharedpreferences.edit();
  9.  
  10. editor.putString(userName , username);
  11. editor.putString(userPassword , password);
  12. editor.commit();
  13. //redireccionas por ejemplo a otra Activity
  14. perfil = new Intent(MainActivity.this,second_main.class);
  15. startActivity(in);
  16.  
  17. SharedPreferences sharedPref = getActivity().getPreferences(Context.MODE_PRIVATE);
  18. String username = getResources().getString("nombreUsuario");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement