0

When I run the code or app in my Google Pixel 3 smartphone, the code works fine for two input commands and the app terminates straight after.

There is a button for random dice generator and an input box for users to type numbers between 1-6. If they guess the number that matches the random dice generator, their point is incremented by one.

int countPoints = Integer.parseInt(points.getText().toString());//converts the textview into an integer object
                    int addPoints = countPoints + 1;//increment the points by 1

The app or code runs for two inputs of the user then closes down. The app is run on my Google pixel 3. When I get rid of the code above, the app does not close down and works fine. This code should initially work.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
N4533M1
  • 9
  • 2
  • 2
    We need more information on this one... Please post the logcat error output and the full code if possible, So that we get to know what could be the cause – AgentP Nov 04 '19 at 14:23
  • 2
    Without seeing your logcat, I can only *WILD GUESS* a NumberFormatException. – Phantômaxx Nov 04 '19 at 14:29
  • use `Integer countPoints` instead of `int countPoints` . – Ravi Rajput Nov 04 '19 at 14:30
  • 1
    Please past your stack trace. There are some tips how to do that: https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this/23353174#23353174 – Panicum Nov 04 '19 at 14:32

0 Answers0