You can use the TimerTask class with the postDelayed method.
private TimerTask mTask = new TimerTask() {
@Override
public void run() {
postDelayed(this, REPEAT_INTERVAL);
}
};
And in your OnCreate, launch TimerTask for the first time:
postDelayed(mTask, INITIAL_DELAY);
You can find some information in this article in android
http://developer.android.com/resources/articles/timed-ui-updates.html
source
share