@Override
public void onFinish() {
times.setText("Time is up");
}
@Override
public void onTick(long millisUntilFinished) {
// TODO Auto-generated method stub
long millis = millisUntilFinished;
String hms = String.format(
"%02d:%02d:%02d",
TimeUnit.MILLISECONDS.toHours(millis),
TimeUnit.MILLISECONDS.toMinutes(millis)
- TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS
.toHours(millis)),
TimeUnit.MILLISECONDS.toSeconds(millis)
- TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS
.toMinutes(millis)));
System.out.println(hms);
times.setText(hms);
}
}
答案 0 :(得分:0)
从onFinish()
调用Start活动@Override
public void onFinish() {
times.setText("Время вышло");
//Start Activity
Intent intent= new Intent(activityName.this, ResultActivity.class);
startActivity(intent);
}
答案 1 :(得分:0)
在onFinish()中使用intent启动Activity。你也可以加入额外的东西。
@Override
public void onTick(long millisUntilFinished) {
// TODO Auto-generated method stub
long millis = millisUntilFinished;
String hms = String.format(
"%02d:%02d:%02d",
TimeUnit.MILLISECONDS.toHours(millis),
TimeUnit.MILLISECONDS.toMinutes(millis)
- TimeUnit.HOURS.toMinutes(TimeUnit.MILLISECONDS
.toHours(millis)),
TimeUnit.MILLISECONDS.toSeconds(millis)
- TimeUnit.MINUTES.toSeconds(TimeUnit.MILLISECONDS
.toMinutes(millis)));
System.out.println(hms);
times.setText(hms);
}
@Override
public void onFinish() {
times.setText("Time is up");
Intent resultActivityIntent= new Intent(currentActivityName.this, ResultActivity.class);
startActivity(resultActivityIntent);
}