Android アプリでタイマーを使用しています。
これは私が使用しているものです、
Timer t = new Timer();
//Set the schedule function and rate
t.scheduleAtFixedRate(new TimerTask() {
public void run()
{
//Called each time when 1000 milliseconds (1 second) (the period parameter)
runOnUiThread(new Runnable() {
public void run()
{
TextView tv = (TextView) findViewById(R.id.timer);
tv.setText(String.valueOf(time));
time += 1;
}
});
}
},
//Set how long before to start calling the TimerTask (in milliseconds)
0,
//Set the amount of time between each execution (in milliseconds)
1000);
私のコードでは、ご覧のとおりしかありseconds
ませんが、のように分と秒で表示したいのです00:01
。
だから、それを行う方法。私を助けてください。
前もって感謝します。