我在Android中制作了一个应用程序,并像这样使用计时器...
try {
CountDownTimer start1 = new CountDownTimer(20000, 1000) {
public void onTick(long millisUntilFinished) {
TextView timeShow = (TextView)findViewById(R.id.showTime);
timeShow.setText(" "+" 00:" +millisUntilFinished / 1000);
}
但是我的问题是我不知道如何停止计时器。有什么想法吗?
我已经尝试过:
quitApplication.setOnClickListener(new OnClickListener() {
public void onClick(View v) {
start1.cancel();
Intent i = new Intent(v.getContext(), startGame.class);
startActivity(i);
// TODO Auto-generated method stub
}
});