Java tutorial
//package com.java2s; public class Main { private static Thread sUIThread; public static boolean isOnUIThread() { Thread currentThread = Thread.currentThread(); return currentThread == sUIThread; } }