final Handler handler = new Handler() { public void handleMessage(Message msg) { switch (msg.what) { case 1: right2.setVisibility(View.INVISIBLE); InitializeQuestion(); break; } super.handleMessage(msg); } }; TimerTask task = new TimerTask() { public void run() { Message message = new Message(); message.what = 1; handler.sendMessage(message); } }; Timer timer = new Timer(); timer.schedule(task, 1500);