Android examples for java.lang:Thread
get Main Thread Handler
//package com.java2s; import android.os.Handler; import android.os.Looper; public class Main { private static Handler sMainThreadHandler; /**//from ww w . j a v a 2s .com * @return a {@link Handler} tied to the main thread. */ public static Handler getMainThreadHandler() { if (sMainThreadHandler == null) { // No need to synchronize -- it's okay to create an extra Handler, which will be used // only once and then thrown away. sMainThreadHandler = new Handler(Looper.getMainLooper()); } return sMainThreadHandler; } }