美文网首页
Android判断是不是在主线程

Android判断是不是在主线程

作者: anhuili | 来源:发表于2017-11-29 16:30 被阅读160次

    方法一:使用Looper类判断

    Looper.myLooper() == Looper.getMainLooper()

    方法二:通过查看Thread类的当前线程

    Thread.currentThread() == Looper.getMainLooper().getThread()

    相关文章

      网友评论

          本文标题:Android判断是不是在主线程

          本文链接:https://www.haomeiwen.com/subject/axifsttx.html