Shedule periodic tasks.
ScheduledExecutorService mScheduledExecutorService = Executors.newScheduledThreadPool(1);;
Future<?> mFuture = mScheduledExecutorService.scheduleAtFixedRate(new Runnable()
{
public void run()
{
// Task to do periodically
}
}, 0L, updateTime, TimeUnit.SECONDS);