Java tutorial
//package com.java2s; import android.os.Looper; import android.util.Log; public class Main { public static final String TAG = "ThreadUtils"; public static boolean isInMainThread() { Looper myLooper = Looper.myLooper(); Looper mainLooper = Looper.getMainLooper(); Log.i(TAG, "isInMainThread myLooper=" + myLooper + ";mainLooper=" + mainLooper); return myLooper == mainLooper; } }