Android Process closed onClick
I am trying to make a score increment when an answer is shown as correct in a textfield. The code is as follows:
Variable is declared:
static int score = 0;
Method:
public void score(){
if(check.getText().equals("开发者_如何学编程Correct")){
score++;
}
Score.setText(String.valueOf(score));
}
The Score is a textfield and check is another textfield
Then this is called in onclick as score();
I appreciate any ideas on why this gets a process closed error when I am clicking the button.
Thanks.
Edit:
Best advice I can give is set a break point at your if statement then use the debugger to see what is null.
精彩评论