Android判断当前是否在主线程
2020-05-30 本文已影响0人
卡路fly
public boolean isMainThread() {
return Looper.getMainLooper() == Looper.myLooper();
}
public boolean isMainThread() {
return Looper.getMainLooper().getThread() == Thread.currentThread();
}
public boolean isMainThread() {
return Looper.getMainLooper().getThread().getId() == Thread.currentThread().getId();
}