Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- protected void onCreate(Bundle savedInstanceState){
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_usuario);
- lblBienvenida = (TextView)findViewById(R.id.lblBienvenida);
- calendario = (DatePicker)findViewById(R.id.calendario);
- tablePaciente = (TableLayout)findViewById(R.id.tablePaciente);
- i = getIntent();
- calendario.init(0, 0, 0, new DatePicker.OnDateChangedListener(){
- @Override
- public void onDateChanged (DatePicker datePicker, int año, int mes, int dia){
- String username = i.getStringExtra("us_usuario");
- String password = i.getStringExtra("us_clave");
- lblBienvenida.setText("Bienvenid@: "+username);
- int Año = calendario.getYear();
- int Mes = calendario.getMonth()+1;
- int Dia = calendario.getDayOfMonth();
- Response.Listener<String> responseListener = new Response.Listener<String>(){
- @Override
- public void onResponse(String response){
- try{
- JSONObject jsonResponse = new JSONObject(response);
- boolean success = jsonResponse.getBoolean("success");
- if(success){
- String [] arrayRespuesta = new String [jsonResponse.length()];
- for(int x = 0; x<jsonResponse.length()-9; x++){
- arrayRespuesta [x] = jsonResponse.getString(x+"");
- }
- tablePaciente.removeAllViews();
- TablaPacientes tabla = new TablaPacientes(Usuario.this, tablePaciente);
- cargarTabla(tabla, arrayRespuesta);
- }else{
- AlertDialog.Builder builder = new AlertDialog.Builder(Usuario.this);
- builder.setMessage("error Login")
- .setNegativeButton("Retry", null)
- .create().show();
- }
- }catch(JSONException e){
- AlertDialog.Builder builder = new AlertDialog.Builder(Usuario.this);
- builder.setMessage(e.getMessage())
- .setNegativeButton("Retry", null)
- .create().show();
- }
- }
- };
- String fecha = Año+"-"+Mes+"-"+Dia;
- RegisterRequest registerRequest = new RegisterRequest(username, password, fecha, responseListener);
- RequestQueue queue = Volley.newRequestQueue(Usuario.this);
- queue.add(registerRequest);
- }
- });
- }
Add Comment
Please, Sign In to add comment