Upload
manuel-gutierrez
View
206
Download
0
Embed Size (px)
Citation preview
OPERACIONES
ARITMETIC
AS UTILIZANDO
RADIO BUTTON
EDITH YAMILETH GONZALEZ
CARO
JORGE ENRIQ
UE SANT IAGO
GARCIA
A
Abrimos nuestro nuevo proyecto de aplicación android
Le damos un nombre
Eliminamos el hello world
Creamos los text view,los radiobutton, los plain text y el button
AGREGAMOS EL SIGUIENTE CODIGO public void operar(View view) { EditText et1=(EditText)findViewById(R.id.et1); EditText et2=(EditText)findViewById(R.id.et2); TextView tv3=(TextView)findViewById(R.id.tv3); RadioButton radio0=(RadioButton)findViewById(R.id.radio0); RadioButton radio1=(RadioButton)findViewById(R.id.radio1); int nro1=Integer.parseInt(et1.getText().toString()); int nro2=Integer.parseInt(et2.getText().toString());
if (radio0.isChecked()==true) { int suma=nro1+nro2; String resu=String.valueOf(suma); tv3.setText(resu); } else if (radio1.isChecked()==true) { int resta=nro1-nro2; String resu=String.valueOf(resta); tv3.setText(resu); } }
Lo corremos..
LISTO