Repeat a task with a time delay?

You should use Handler‘s postDelayed function for this purpose. It will run your code with specified delay on the main UI thread, so you will be able to update UI controls. private int mInterval = 5000; // 5 seconds by default, can be changed later private Handler mHandler; @Override protected void onCreate(Bundle bundle) { // … Read more