runOnUiThread和在子线程运行
来源:互联网 发布:网络环境搭建 编辑:程序博客网 时间:2024/06/05 19:43
// A instance of Activity
....
.
runOnUiThread(new Runnable() {
public void run()
{
TextView textBox= (TextView)getViewById(R.id.textbox);
textBox.setText(R.string.login_failed);
}
....
.
runOnUiThread(new Runnable() {
public void run()
{
TextView textBox= (TextView)getViewById(R.id.textbox);
textBox.setText(R.string.login_failed);
}
});
内部实现其实就是调用的hander.post();
// Reference from Activity.java
/**
* Runs the specified action on the UI thread. If the current thread is the UI
* thread, then the action is executed immediately. If the current thread is
* not the UI thread, the action is posted to the event queue of the UI thread.
*
* @param action the action to run on the UI thread
*/
public final void runOnUiThread(Runnable action) {
if (Thread.currentThread() != mUiThread) {
mHandler.post(action);
} else {
action.run();
}
}
0 0
- runOnUiThread和在子线程运行
- 使用子线程和runOnUiThread 显示时间
- 确保显示操作运行在UI线程 - runOnUiThread
- 确保显示操作运行在UI线程 - runOnUiThread
- Android 子线程更新UI:handle和runOnUiThread()
- 19 子线程刷新UI runOnUiThread
- runOnUiThread()方法实现在子线程中更新UI组件
- Android运行在主线程和子线程浅释
- IOS 在子线程运行performSelector和NSTimer
- runOnUIThread、Handler、AsyncTask与子线程结合使用更新UI
- Android在其它线程中更新UI,runOnUiThread() (转载)
- runOnUiThread 线程更改
- [C#]在线程运行过程中关闭子对话框
- iOS 多线程初步研究-NSURLConnection在子线程中运行
- 如何让NSURLConnection在子线程中运行
- performSelector afterDelay在子线程上调用不运行
- performSelector withObject afterDelay 在子线程上调用不运行
- performSelector withObject afterDelay 在子线程上调用不运行
- OC之初始类和对象
- P2P网贷谋求“去担保”:引入保险 收益下滑
- 定制iOS 7中的导航栏和状态栏
- hive 查询执行分析
- 数据库Sharding的基本思想和切分策略
- runOnUiThread和在子线程运行
- HttpClient超时故障
- Linux下网络流量实时监控工具 大全
- phonegap 添加admob广告教程
- easyexplore的下载,安装和使用
- “Unknown register name 'q0' in asm”
- yate--sip server的学习过程
- VS2010 中更改项目名称
- Linux中硬链接和软链接的区别和联系