give a delay of few seconds without using threads
问题 How can I give a delay of few seconds without using threads.some function that I can call anywhere for giving delay. Android built-in function is highly preferred. Thanks 回答1: Use a Handler, and send either a simple message or a Runnable to it using a method such as postDelayed(). For example, define a Handler object to receive messages and Runnables: private Handler mHandler = new Handler(); Define a Runnable: private Runnable mUpdateTimeTask = new Runnable() { public void run() { // Do some