我Chronometer
在我的主要活动中有这个,我想在用户完成 mainActivity.class 中的给定任务后获取这个计时器的值并将其显示到下一个活动(end.class)
MainActivity.class片段:
private void showElapsedTime() {
long timeElapsed = SystemClock.elapsedRealtime() - chrono.getBase();
int millis = (int) timeElapsed;
int seconds = (int) timeElapsed/1000;
int minutes = seconds/60;
Toast.makeText(this, "Level1 - Elapsed time: " + minutes + ":" + seconds,
Toast.LENGTH_LONG).show();
}
结束类:
TextView Set1;
Set1 = (TextView) findViewById (R.id.time1);
如何从 MainActivity.class 获取计时器值并将其显示在 end.class 的 textview 中?