Java tutorial
//package com.java2s; import android.os.Looper; public class Main { /** * @return Whether or not the current thread is the UI thread */ public static boolean isUIThread() { return (Looper.getMainLooper() == Looper.myLooper()); } }