方法一:使用Looper类判断
Looper.myLooper() == Looper.getMainLooper()
方法二:通过查看Thread类的当前线程
Thread.currentThread() == Looper.getMainLooper().getThread()
方法三:直接判断
"main".equals(Thread.currentThread().getName())
方法一:使用Looper类判断
Looper.myLooper() == Looper.getMainLooper()
方法二:通过查看Thread类的当前线程
Thread.currentThread() == Looper.getMainLooper().getThread()
方法三:直接判断
"main".equals(Thread.currentThread().getName())