在Android 中判断当前的Thread是否是UI Thread 的方法:

  1.

if (Looper.myLooper() == Looper.getMainLooper()) {
// Current thread is the UI/Main thread
}

2.

if (Looper.getMainLooper().getThread() == Thread.currentThread()) {
// Current thread is the UI/Main thread
}

参考如下文章:其中还讲到了  runOnUiThread()  方法的用法。

http://codetheory.in/checkdetect-whether-current-thread-uimain-thread-android/

http://lak4cyut.blogspot.jp/2011/03/android-tip-activityrunonuithread.html

最新文章

  1. 探究@property申明对象属性时copy与strong的区别
  2. 论C#之多继承
  3. Ruby之基本数据类型(三)
  4. Oracle创建表空间、用户、授权
  5. 多线程更新UITableView时容易导致的问题
  6. angularjs指令系统系列课程(3):替换replace,内容保留transclude,作用方式restrict
  7. Content-Type: application/vnd.ms-excel">
  8. Possion 分布
  9. 学习opengl(起步)
  10. js文本框验证
  11. iOS崩溃日志分析-b
  12. libvirtsAPI
  13. 基于KMP与Levenshtein模糊匹配算法的银行联行号查询(转)
  14. Andrid 多线程下载
  15. php提供service总结---wsdl篇
  16. 使用ActionBar实现下拉式导航
  17. 201521123095《java程序设计》第4周学习总结
  18. HTML <select>标签
  19. Python基础:条件判断与循环的两个要点
  20. IIS 常用命令

热门文章

  1. C#实现麦克风採集与播放
  2. shell取余数
  3. windows phone 切换多语言时,商店标题显示错误的问题
  4. SecureCRT配置自动保存日志(实用)
  5. centOS7 配置DNS上外网
  6. 一款基于jQuery和HTML5全屏焦点图
  7. Can't zip RDDs with unequal numbers of partitions
  8. jQuery插件开发全解析<转>
  9. 2015 Multi-University Training Contest 3 1006 Beautiful Set
  10. MS SQL Server2012中的EOMONTH函数