[Android] Delay processing using postDelayed method


Writing time : 2016-08-13 00:48:39

Delay processing using postDelayed method

If you want to give delay and do some action, use the postDelayed method of Handler class.

The code below will do the job after 3 seconds.

Handler delayHandler = new Handler();  
delayHandler.postDelayed(new Runnable() {  
@Override  
public void run() {  
// TODO  
}  
}, 3000);