Android - ayuda!! sobre una consulta

 
Vista:

ayuda!! sobre una consulta

Publicado por duda sobre aplicacion (1 intervención) el 06/01/2014 04:08:25
hola mi problema es el siguiente

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
public class MainActivity extends Activity {
 
	private EditText et1,et2;
	private TextView tv4;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        et1=(EditText)findViewById(R.id.et1);
        et2=(EditText)findViewById(R.id.et2);
     tv4=(TextView)findViewById(R.id.tv4);
 
    }
 
 
    @Override
    public boolean onCreateOptionsMenu(Menu menu) {
        // Inflate the menu; this adds items to the action bar if it is present.
        getMenuInflater().inflate(R.menu.main, menu);
        return true;
    }
 
    public void sumar(View view) {
        String valor1=et1.getText().toString();
        String valor2=et2.getText().toString();
        int nro1=Integer.parseInt(valor1);
        int nro2=Integer.parseInt(valor2);
        int suma=nro1+nro2;
        String resu=String.valueOf(suma);
        tv4.setText(resu);
    }
 
 
}

me sale erro en el emulador de android
pero cuando quieto o elimino las lines que tien e
el textview tv4 la apliacaion corre bien
que puedo hacer ?
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de fracisco
Val: 466
Oro
Ha mantenido su posición en Android (en relación al último mes)
Gráfica de Android

respuesta

Publicado por fracisco (358 intervenciones) el 11/01/2014 02:25:10
tv4.setText(resu);
Deberías convertir el texto en Sterling así

tv4.setText("" + resu);

Esto deberá funcionar
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar