因此,我有一个名为temp的ArrayList,每个项的每个项都有一个可变的temp。时间过后,我需要每次运行MyTimerTask。
ArrayList<Command> temp = interpritor(editor.getText().toString());
int time = 0;
for (int i=0; i < temp.size(); i++) {
time = time + temp.get(i).time;
timer.get(i).schedule(myTimerTask, time * 1000);
}
class MyTimerTask extends TimerTask {
@Override
public void run() {
runOnUiThread(new Runnable() {
@Override
public void run() {
Toast.makeText(MainActivity.super.getApplicationContext(),"K",Toast.LENGTH_SHORT).show();
}
});
}
}