提交 23105fea 编写于 作者: B Blankj

see 05/18 log

上级 06e577c4
package com.blankj.utilcode.util;
import android.os.Looper;
/**
* <pre>
* author: Blankj
* blog : http://blankj.com
* time : 2018/05/17
* desc :
* </pre>
*/
public class ThreadUtils {
/**
* Returns {@code true} if called on the main thread, {@code false} otherwise.
*/
public static boolean isOnMainThread() {
return Looper.myLooper() == Looper.getMainLooper();
}
/**
* Returns {@code true} if called on a background thread, {@code false} otherwise.
*/
public static boolean isOnBackgroundThread() {
return !isOnMainThread();
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册