assert In Main Thread - Android java.lang

Android examples for java.lang:Thread

Description

assert In Main Thread

Demo Code

import android.content.Context;

public class Main {

  private static Context sContext;

  public static void assertInMainThread() {
    if (Thread.currentThread() == sContext.getMainLooper().getThread()) {
      throw new AssertionError();
    }//from  w  w  w  . j  a va2 s . c o m
  }

}

Related Tutorials