Android examples for java.lang:Thread
assert Ui Thread
//package com.java2s; import static android.os.Looper.getMainLooper; import static android.os.Looper.myLooper; public class Main { static void assertUiThread() { if (myLooper() != getMainLooper()) { throw new IllegalStateException( "Must be called from UI thread. Current thread: " + Thread.currentThread()); }//from ww w . j av a 2s . com } }