⚠ 昔書いた記事の流用です。
final int delayMilli = 10000; // 定期実行間隔をミリ秒で指定する.
final Handler handler = new Handler();
final Runnable r = new Runnable() {
@Override
public void run() {
// f(); 定期実行したい関数.
// invalidate(); 再描画する場合は,これを有効にする.
handler.postDelayed(this, delayMilli);
}
};
handler.post(r);