int delayTime = 2 *1000; Timer timetToDo = new Timer(); TimerTask tt = new TimerTask() { public void run() { // do something } }; timetToDo.schedule(tt, delayTime);