|
||
|
![]() |
![]() |
Programación y Desarrollo para Android Subforo exclusivo para temas de programación de software para PDAs y desarrollo de aplicaciones, interfaces, etc bajo Android |
![]() |
|
Herramientas |
#1
|
||||
|
||||
Problema con EditText Android
Hola, me encuentro haciendo una calculadora con dos editText en Android Studio, colocando botones y estos me escriben en un solo editText.
public void prueba(View view){ EditText num1 = (EditText) findViewById(R.id.num1); String strNum1 = num1.getText().toString(); switch (view.getId()){ case R.id.boton0: strNum1 = strNum1 + "0"; break; case R.id.boton1: strNum1 = strNum1 + "1"; break; case R.id.boton2: strNum1 = strNum1 + "2"; break; case R.id.boton3: strNum1 = strNum1 + "3"; break; case R.id.boton4: strNum1 = strNum1 + "4"; break; case R.id.boton5: strNum1 = strNum1 + "5"; break; case R.id.boton6: strNum1 = strNum1 + "6"; break; case R.id.boton7: strNum1 = strNum1 + "7"; break; case R.id.boton8: strNum1 = strNum1 + "8"; break; case R.id.boton9: strNum1 = strNum1 + "9"; break; default: Toast.makeText(this, "Ha sucedido un error", Toast.LENGTH_LONG).show(); break; } num1.setText(strNum1); } He intentado hacerlo para el otro editText pero no lo he logrado seria de gran ayuda, si me pueden colaborar con este problema ![]() |
|
![]() |
![]() |
||||||
|