我有这个线程:
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();
我想取消它,我尝试了t.interrupt();
,但没有起作用,还有其他的方法吗?