六狼论坛

 找回密码
 立即注册

QQ登录

只需一步,快速开始

新浪微博账号登陆

只需一步,快速开始

搜索
查看: 56|回复: 0

不能创建处理器 Can't create handler inside thread that has not called Looper.prepare()

[复制链接]

升级  56%

40

主题

40

主题

40

主题

秀才

Rank: 2

积分
134
 楼主| 发表于 2013-1-14 18:05:15 | 显示全部楼层 |阅读模式
Android 2.3.3       Eclipse Version: 3.7.0       LogCat   
LogCat 报错信息:
02-06 15:07:52.794: WARN/dalvikvm(503): threadid=18: thread exiting with uncaught exception (group=0x40015560)02-06 15:07:52.815: ERROR/AndroidRuntime(503): FATAL EXCEPTION: Thread-4902-06 15:07:52.815: ERROR/AndroidRuntime(503): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()02-06 15:07:52.815: ERROR/AndroidRuntime(503): at android.os.Handler.(Handler.java:121)02-06 15:07:52.815: ERROR/AndroidRuntime(503): at android.app.Activity.(Activity.java:680)02-06 15:07:52.815: ERROR/AndroidRuntime(503): at android.app.ListActivity.(ListActivity.java:175)02-06 15:07:52.815: ERROR/AndroidRuntime(503): at android.preference.PreferenceActivity.(PreferenceActivity.java:76)02-06 15:07:52.815: ERROR/AndroidRuntime(503): at com.tmall.iphone4s.manage.Preference.(Preference.java:62)02-06 15:07:52.815: ERROR/AndroidRuntime(503): at com.tmall.iphone4s.Check.run(Check.java:297)02-06 15:07:52.815: ERROR/AndroidRuntime(503): at java.lang.Thread.run(Thread.java:1019)02-06 15:07:52.864: WARN/ActivityManager(61): Force finishing activity com.tmall.iphone4s/.PlayAd发生错误原因:线程内未调用Looper.prepare(),不能创建处理器。
解决办法:在线程Check的run()中加入 Looper.prepare();
public void run() {// TODO Auto-generated method stubsuper.run();Looper.prepare();setting = new Preference(context);check();} 
您需要登录后才可以回帖 登录 | 立即注册 新浪微博账号登陆

本版积分规则

快速回复 返回顶部 返回列表