Toast 和Timer与 Can't create handler inside thread that has not called Looper.prepare()问题
来源:互联网 发布:淘宝二手官方下载 编辑:程序博客网 时间:2024/06/05 19:29
参考资料:http://jeff-pluto-1874.iteye.com/blog/869710,
http://www.cnblogs.com/Greenwood/archive/2011/02/27/1966472.html。
关键代码
Timer timer=new Timer();timer.schedule(new TimerTask() {@Overridepublic void run() {Looper.prepare();// TODO Auto-generated method stubToast.makeText(getApplicationContext(), "您的账户已经刷新.", Toast.LENGTH_SHORT).show();Looper.loop(); //codes after this will not be excuted.}}, 5000);
Looper.prepare()和 Looper.loop()的位置很重要。Looper.loop()后的代码是不会被执行的来。
- Toast 和Timer与 Can't create handler inside thread that has not called Looper.prepare()问题
- Handler机制和Can't create handler inside thread that has not called Looper.prepare()异常
- Can't create handler inside thread that has not called Looper.prepare() 错误有关问题
- Can't create handler inside thread that has not called Looper.prepare() 错误有关问题
- Can't create handler inside thread that has not called Looper.prepare() 问题
- 解决Can't create handler inside thread that has not called Looper.prepare() inside AsyncTask
- 子线程调用Toast报Can't create handler inside thread that has not called Looper.prepare() 错误
- 子线程调用Toast报Can't create handler inside thread that has not called Looper.prepare() 错误
- Handler——Can't create handler inside thread that has not called Looper.prepare()
- Can't create handler inside thread that has not called Looper.prepare()错误的解决
- Can't create handler inside thread that has not called Looper.prepare() 异常
- Can't create handler inside thread that has not called Looper.prepare()
- Can’t create handler inside thread that has not called Looper.prepare()
- Can’t create handler inside thread that has not called Looper.prepare()
- Can't create handler inside thread that has not called Looper.prepare()解决办法
- Can't create handler inside thread that has not called Looper.prepare() 终极解决方法
- 异常Can't create handler inside thread that has not called Looper.prepare() 解决方法
- Can't create handler inside thread that has not called Looper.prepare()错误的解决
- hbernate学习(三)一对一双向关联
- 敏捷日志2013-1-21
- 嵌入式linux应用开发完全手册学习笔记三(windows、linux下工具使用)
- 硬链接和软链接(hard link&soft link)
- Poj 1042 Gone Fishing
- Toast 和Timer与 Can't create handler inside thread that has not called Looper.prepare()问题
- id software编程规范
- 如何将shp数据导入Oracle Spatial
- 【Oracle在线笔试题】const_cast的应用
- android聊天表情开发
- LoadRunner--信与不信之间
- Android对Linux内核的增强:Low Memory Killer(低内存管理)
- 挑战编程 程序设计竞赛训练手册-1.6.6 解释器(Interpreter)
- 常见的棋牌游戏网站支付接口