Os utilitários java esperam segundos
try
{
Thread.sleep(1000);
}
catch(InterruptedException ex)
{
Thread.currentThread().interrupt();
}
Clear Curlew
try
{
Thread.sleep(1000);
}
catch(InterruptedException ex)
{
Thread.currentThread().interrupt();
}
Handler handler = new Handler();
handler.postDelayed(new Runnable() {
public void run() {
// yourMethod();
}
}, 5000); //5 seconds
Syntax :
=========================================================
Thread.sleep(1000); // 1000 milliseconds.. |
=========================================================
int i=0;
for(;;){
Thread.sleep(2000); // set time delay to 2 seconds..
System.out.println(i++); // output : every output will display after 2 seconds..
}
TimeUnit.SECONDS.sleep(1);