Exemplo n.º 1
0
  private void savePreferences() {

    SharedPreferences.Editor datos = shared.edit();

    datos.putString("idUser", DataModel.getInstance().getAppUser().getIdUser());
    datos.putString("user", DataModel.getInstance().getAppUser().getUser());
    datos.putString("password", DataModel.getInstance().getAppUser().getPassword());
    datos.putString("idPerson", DataModel.getInstance().getAppUser().getIdPerson());
    datos.commit();
  }
Exemplo n.º 2
0
 @Override
 public void onResponse(JSONObject jsonResponse) throws Exception {
   JSONObject user;
   Intent intent = new Intent(getApplicationContext(), MainActivity.class);
   dialog.cancel();
   if (jsonResponse.has("usuario")) {
     user = jsonResponse.getJSONObject("usuario");
     DataModel.getInstance().setAppUser(new UserVO());
     DataModel.getInstance().getAppUser().setIdUser(user.getString("idUser"));
     DataModel.getInstance().getAppUser().setUser(user.getString("user"));
     DataModel.getInstance().getAppUser().setPassword(textPass.getText().toString());
     DataModel.getInstance().getAppUser().setIdPerson(user.getString("idPerson"));
     savePreferences();
     textUser.setText("");
     textPass.setText("");
     startActivity(intent);
   }
 }