android - TextView setText not working inside ScheduledExecutorService runOnUiThread -


code :

private void starttimer() {     final scheduledexecutorservice scheduletaskexecutor = executors.newscheduledthreadpool(1);     scheduletaskexecutor.scheduleatfixedrate(new runnable() {         @override         public void run() {             runonuithread(new runnable() {                 public void run() {                     int count = 60;                     time.settext(count - 1 + "");                     count--;                 }             });         }     }, 0 , 1000, timeunit.milliseconds); } 

i want update text in textview every 1 second, seems work first time , later text not updated.

anyone know what's issue ??

int count = 60; private void starttimer() { final scheduledexecutorservice scheduletaskexecutor = executors.newscheduledthreadpool(1); scheduletaskexecutor.scheduleatfixedrate(new runnable() {     @override     public void run() {        runonuithread(new runnable() {           public void run() {              if(count > 0){                time.settext(count - 1 + "");                count--;              }           }        });      }    }, 0 , 1000, timeunit.milliseconds); } 

Comments