I am a noob learning Android and making my own little demo project at the same time.
Basically, when the user starts my app it shows levels.java with 8 buttons, when the user clicks the 8th button this fires:
public void button_clicked8(View v) {
text1.setText("clicked 8");
startActivity(new Intent(this, GameScreen.class));
}
which starts my main gamescreen class where the simple game is played.
If the user gets the math problem wrong 3 times, the game is over and I fire this code:
r_settings.setGameStarted(false);
r_settings.setGameOver(0);
r_settings.setInternalLevel(0);
r_settings.setDisplayLevel(0);
this.finish();
which basically resets some static variables and sends the user back to the levels.java screen.
So far all of the above works like a charm, in the levels screen if the user presses the 8 button again the game starts again, the problem is this works for around 4 times, on the 4th or 5th time it goes to the gamescreen but nothing works… and then in logcat I get this error:
http://imageshack.us/photo/my-images/546/68081548.png/
http://imageshack.us/photo/my-images/59/93717315.png/
(you need to click the image to see it full size)
Where am I going wrong?
Thanks!
R
Well, you get a NullPointerException at GameScreen.java:64. Does it work after you fix that?