Activity # runOnUiThread 与 View # post
2024-08-26 08:46:29
There is no real difference, except that the View.post
is helpful when you don't have a direct access to the activity.
public boolean post(Runnable action) {
Handler handler;
if (mAttachInfo != null) {
handler = mAttachInfo.mHandler;
} else {
// Assume that post will succeed later
ViewRoot.getRunQueue().post(action);
return true;
} return handler.post(action);
}
public final void runOnUiThread(Runnable action) {
if (Thread.currentThread() != mUiThread) {
mHandler.post(action);
} else {
action.run();
}
}
最新文章
- CSS3写折纸
- PBOC金融IC卡,卡片与终端交互的13个步骤,简介-第一组(转)
- 13,SFDC 管理员篇 - 移动客户端
- 三、Spring——数据访问
- [ACM_数学] 大菲波数 (hdu oj 1715 ,java 大数)
- 用Java集合中的Collections.sort方法对list排序的两种方法
- 【原】NGUI中的UIRoot脚本功能
- react 资源汇总
- tomcat------https单向认证和双向认证
- Ubuntu下安装composer及配置
- [jquery备忘]
- 使用ViewPagerAdapter 页面引导适配器设置app启动页,引导页面的实现
- HTML5新增web存储方式
- websphere部署--web应用-以自己的项目为例
- MongoDB(一)环境搭建与初始配置
- json文件格式详解
- Python 命令行工具 argparse 模块使用详解
- sass基础—属性嵌套以及跳出嵌套 @at-root
- java.awt.headless 模式
- [Robot Framework] SikuliLibrary的关键字执行依赖java进程,但是上次的java进程如果没有杀掉,robot framework控制台的日志出不来,怎么办?