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' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -