1//deprecated in main thread:
2try {
3 Thread.sleep(1000);//time is in ms (1000 ms = 1 second)
4} catch (InterruptedException e) {e.printStackTrace();}
5
6//please use bellow instead:
7Timer timer = new Timer();
8timer.schedule(new TimerTask() {
9 @Override
10 public void run() {
11 //what you want to do
12 }
13}, 1000);//wait 1000ms before doing the action