Cancel android thread programmatically -


i have thread:

                    t = new thread() {                     @override                     public void run() {                         try {                             while (!isinterrupted()) {                                 thread.sleep(1);                                 runonuithread(new runnable() {                                     @override                                     public void run() {                                         timecounter++;                                         textview.settext("your reaction time:"                                                 + timecounter + "ms");                                     }                                 });                             }                         } catch (interruptedexception e) {                         }                     }                 };                  t.start(); 

i want cancel , tried t.interrupt(); didn't work, there other way?

i had issue related before. might find link useful how solved problem. also, mentioned, quite odd setting thread sleep 1 millisecond. thread isn't removed properly


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -