Reputation: 1042
So, I have 16 buttons, and when user clicks on a button I setText to it from db. He now has guess final answer from these term. I need to add him a point for each button that he did not clicked in his game. I tried:
if(!button.isPressed){
points = points + 1;
}
This did not work.
Upvotes: 0
Views: 73
Reputation: 1439
Initialize points to 16 and on each button click reduce it by one.
Point left finally would automatically equal to number of buttons not pressed.
Upvotes: 1
Reputation: 10343
Make a global counter and increase it on every button press (onClickListener). Then deduct the counter from the total number of buttons and that's your score.
Upvotes: 4