应用程序将在t.stop()时崩溃; 情况:我想每2秒(25次)将textview文本保存到数组;
t = new Thread() {
public void run() {
try {
while (!isInterrupted()) {
Thread.sleep(2000);
runOnUiThread(new Runnable() {
@Override
public void run() {
// update TextView here!
if (i < 25) {
mypDialog.setProgress(i * 4);
getRssi(iBeaconPosition, i);
i++;
} else {
finishCalibration();
}
}
});
}
} catch (InterruptedException e) {
}
}
};
t.start();