Doubt about increasing value | SoloLearn: Learn to code for FREE!

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); }

5/13/2020 2:12:31 PM

Emilio Hurtado

2 Answers

New Answer

0

agrega un ActionListener al boton pars que capture ls accion y haga lo que deseas.

0

Emilio, add a ActionListener for increment the value.