0
0

More than 1 year has passed since last update.

AndroidのJavaで任意関数を一定間隔で実行する方法

Posted at

⚠ 昔書いた記事の流用です。

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);
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0