java - Update score android sdk -
i have problem code,
i update score positiv , negative score no update. thank help.
int score = 5; if(v == findviewbyid(r.id.bottomlinear)) { view view = (view) event.getlocalstate(); viewgroup viewgroup = (viewgroup) view.getparent(); viewgroup.removeview(view); //change text string scr = string.valueof(score++); textview score1 = (textview) findviewbyid(r.id.score); score1.settext(scr); } else if(v == findviewbyid(r.id.bottomlinear2)) { view view = (view) event.getlocalstate(); viewgroup viewgroup = (viewgroup) view.getparent(); viewgroup.removeview(view); //change text string scr = string.valueof(score--); textview score2 = (textview) findviewbyid(r.id.score); score2.settext(scr); }
try set variable , set score
int x = score++; textview score1 = (textview) findviewbyid(r.id.score); score1.settext(integer.tostring(score));
if still not work - you're sure, code going if or else?
another thing - (i'm not sure views) should use in 'if' method "equals" instead of '=='
Comments
Post a Comment