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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

Making Empty C++ Project: General exception (Exception from HRESULT:0x80131500) Visual Studio Community 2015 -

How to fix java warning for "The value of the local variable is not used " -