Tema: Duda en App
Ver Mensaje Individual
  #8  
Viejo 11/04/13, 17:27:09
Array

[xs_avatar]
Celtium Celtium no está en línea
Miembro del foro
 
Fecha de registro: may 2010
Mensajes: 432
Modelo de smartphone: Nexus One, 4

Presonaliza el onclick del boton, asi tendras todo un poco ordenado si llegas a tener muchos botones y haz lo que te dice mocelet, haz el calculo matematico cuando sepas que en el edittexxt hay algun valor, por que cuando no hay nada te petará. No se puede multiplicar un valor null por 0.10.

Código:
boton.setOnClickListener(new OnClickListener() {
                   public void onClick(View v) {
                              if (!editText.getText().toString().trim().equals("")) {
                                    v1 = Double.parseDouble(editText.getText().toString());
                                    eb = v1 * 0.10;//operacion matematica
                                    if (v1 > 200){    //si v1 es mayor de 200
                                            textView1.setText(String.valueOf("60")) //mostrar en el textview1 60
                                    }else{
                                            textView1.setText(String.valueOf(eb));     //sino mostrar en el textView eb, que es una operacion matematica
                              }         
                   }
});
Asi debia ir bien.
__________________

Responder Con Cita