I have this 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 to cancel it , I tried the t.interrupt();
but it didn't work, is there any other way?