java - Why is setText not working? -
so have view made of single textview in middle , change text in textview according user's action, when use following code:
if(condition == 1){     maintext.settext("correct");     try {         wait(100);     } catch (interruptedexception e) {         e.printstacktrace();     }     random r = new random();     int idx = r.nextint(names.length);     random = (names[idx]);     maintext.settext(random);     condition = 0; }   the maintext doesn't change correct, change random.
any idea on how fix this, thanks
you can not use delays on ui thread, fail 100% of time.
set text, , post runnable ui thread delays desired time, , changes text.
view.settext("something"); view.postdelayed(new runnable(){     public void run(){         view.settext("somethingelse.");     } }, 200);      
Comments
Post a Comment