Sign Up

Sign In

Forget Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

You must login to ask question.

Developers Map

How to add simple timer in android

  • 1

Code Sample for add simple timer in android

import java.util.Timer;
import java.util.TimerTask;

Timer timer;

 public void startTimer() {
        timer = new Timer();
        TimerTask timerTask = new TimerTask() {
            public void run() {
                runOnUiThread(new Runnable() {
                    public void run() {
                         //action you need to perform
        timer.scheduleAtFixedRate(timerTask, 0, 10000);
Leave an answer

Leave an answer