The app will breakdown when t.stop(); situation: I want to save the textview text to array every 2s(25times);
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();