android - timer.setText("setTextHere") does not work inside the thread -


timer.settext("settexthere") not work inside thread.

thread thread1 = new thread(){               textview timer;             int t;             public void run(){                 timer=(textview) findviewbyid(r.id.timer);                       try{                     timer.settext("settexthere");                     sleep(5000);                   }                 catch(exception e){                      e.printstacktrace();                                         }                 finally{                     intent new1 = new intent("com.example.app1.menu");                     startactivity(new1);                                     }                                }                        };         thread1.start(); 

_t = new timer(); _t.scheduleatfixedrate( new timertask() {         @override         public void run() {             _count++;             runonuithread(new runnable() //run on ui thread              {               public void run()                {                 _tv.settext( "" + _count );               }              });         }     }, 1000, 1000 );  

Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -