2
"syncingIntervalsInt"時間を待ってからコードを実行する関数があります。カウントダウンはどのように作成できますか? syncingIntervalsIntが10秒に設定されている場合たとえば、私はこのカウントダウン10,9,8へ1つのTextViewを設定するなどハンドラの残り時間を計算する
ここに私の関数である。syncingIntervalsInt後だけデクリメント上記
public void refreshRecycler()
{
countingTillSync = syncingIntervalsInt;
timerHandler = new Handler();
timerRunnable = new Runnable() {
@Override
public void run() {
//some code here
countingTillSync--;
}
timerHandler.postDelayed(this, syncingIntervalsInt*1000); //run every second
}
timerHandler.postDelayed(timerRunnable, syncingIntervalsInt*1000); //Start timer after 1 sec
}
このコード*私が期待するものではない1000時間。
私の回答を確認できますか? – KeLiuyue