0

Doubt about increasing value

Hello everyone! I have recently been learning to program and I have a basic question: I need to create a button in Android Studio, which when touched, increases the value by 1. It's basically a counter. I type this and the app breaks: public void Add(View view){ int shot = 0; shot++; et1.setText(shot); }

13th May 2020, 2:12 PM
Emilio Hurtado
Emilio Hurtado - avatar
2 Réponses
0
agrega un ActionListener al boton pars que capture ls accion y haga lo que deseas.
13th May 2020, 3:47 PM
Jobemar Arreaza
Jobemar Arreaza - avatar
0
Emilio, add a ActionListener for increment the value.
13th May 2020, 3:46 PM
Jobemar Arreaza
Jobemar Arreaza - avatar