Skip to content

Instantly share code, notes, and snippets.

@Manikkumar1988
Created October 17, 2016 07:44
Show Gist options
  • Save Manikkumar1988/bd9f058084d56885d1bdae3bdd309649 to your computer and use it in GitHub Desktop.
Save Manikkumar1988/bd9f058084d56885d1bdae3bdd309649 to your computer and use it in GitHub Desktop.
{
if(timer != null) {
timer.cancel();
}
timer = new Timer();
MyTimerTask myTimerTask = new MyTimerTask();
timer.schedule(myTimerTask, 1000, 5000);
}
class MyTimerTask extends TimerTask {
@Override
public void run() {
runOnUiThread(new Runnable(){
@Override
public void run() {
//Repeating UI task
}
});
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment