android - Track amount of clicks user clicks button -


i wandering if there way track amount of clicks user clicks button.

i creating game , user allowed take 5 turns. after these turns user has lost game.

i need create maybe if statement amount of clicks user takes reaches > 5 user has lost. possible.

i appreciate on this. thanks

edit:

button link2btn = (button)findviewbyid( r.id.answerselected ); 

link2btn.setonclicklistener( new view.onclicklistener() { public void onclick(view v) { i++;

getanswer(); }

the answer method works fine except if > 5 statement within answer is:

else if(i>5){     correctanswer.settext("you have lost"); 

use flag variable , make increment on button press. like

int i=0; 

when button pressed

i++; 

now condition

if(i>5){} 

Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -