i trying increment counter variable (mpresscount
) every time button pressed. question is: mpresscount
1 before gets third if
statement, assuming 0 when button clicked? in other words, when mpresscount++;
read, incremented or button need pressed again before variable incremented?
here code:
mbutton1.setonclicklistener(new view.onclicklistener() { @override public void onclick(view v) { if(mpresscount < 2) { mbutton1.settext(mword4); mbutton1.setclickable(false); mbutton1pressed = true; mpresscount++; if(mbutton7pressed) { mmatchedword4 = true; } } if(mpresscount == 1) { //im going if count @ 1 hope //it is...thanks insights }
if mpresscount begins @ 0 when button pressed, first if statement
if(mpresscount < 2)
executed. including mpresscount++;
make
mpresscount = 1
the code continue executing down file until reaches third if statement if(mpresscount == 1)
executed because said previously, mpresscount = 1
programs reading, go line line. hope helps :)