Thursday, June 25, 2015

Android: Time Loop in milliseconds

You can use timer or thread handler

  timer = new Timer();
        timer.schedule(new TimerTask() {
            @Override
            public void run() {

               Do your own code
                ///////schedule the timer, after the first 100ms the TimerTask will run every 1000ms
            }
        }, 1000, 1000);
Can Use Another handler
Handler handler = new Handler();        
handler.postDelayed(
            new Runnable() {
                public void run() {
                   //  Do your own code
                }
            }, 1000L);

No comments:

Post a Comment