marjanbaz
marjanbaz

Reputation: 1042

How to add points for each unclicked button?

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

Answers (2)

Ashish Chopra
Ashish Chopra

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

IncrediApp
IncrediApp

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

Related Questions