Created
December 23, 2013 06:19
-
-
Save ikew0ng/8092451 to your computer and use it in GitHub Desktop.
检查方法是否运行于主线程
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private void throwIfNotOnMainThread(){ | |
if (Looper.myLooper() != Looper.getMainLooper()) { | |
throw new IllegalStateException("Must be invoked from the main thread."); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment