如果我按下停止按钮并且计时器在00:07停止,我该如何将该值保存为int?
View.OnClickListener mStopListener = new OnClickListener() {
@Override
public void onClick(View view) {
Timer.stop();
saveTime = Timer.getBase();
Intent intent = new Intent(getApplicationContext(),
TableScreen.class).putExtra("timer",saveTime);
startActivity(intent);
}
};
答案 0 :(得分:1)
我弄明白了。
View.OnClickListener mStopListener = new OnClickListener() {
@Override
public void onClick(View view) {
Timer.stop();
saveTime = SystemClock.elapsedRealtime() - Timer.getBase();
int seconds = (int)(saveTime/1000 % 60);
Intent intent = new Intent(getApplicationContext(),
TableScreen.class).putExtra("timer",seconds);
startActivity(intent);
}
};