Android examples for java.lang:Thread
post Background Thread Delayed
//package com.java2s; import android.os.Handler; import android.os.Looper; public class Main { private static Handler sHandler; public static void postBackgroundDelayed(final Runnable run, long delayMills) { if (run == null) return; getHandler().postDelayed(new Runnable() { @Override/*from w w w .ja va2 s. c om*/ public void run() { Thread thread = new Thread(run); thread.start(); } }, delayMills); } public static void postDelayed(Runnable run, long delayMills) { if (run == null) return; getHandler().postDelayed(run, delayMills); } public static Handler getHandler() { if (sHandler == null) sHandler = new Handler(Looper.getMainLooper()); return sHandler; } }