Android Exception 13(Can't create handler inside thread that has not called Looper.prepare())
10-12 17:02:55.500: E/AndroidRuntime(28343): FATAL EXCEPTION: Timer-2
10-12 17:02:55.500: E/AndroidRuntime(28343): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
10-12 17:02:55.500: E/AndroidRuntime(28343): at android.os.Handler.<init>(Handler.java:197)
10-12 17:02:55.500: E/AndroidRuntime(28343): at android.os.Handler.<init>(Handler.java:111)
10-12 17:02:55.500: E/AndroidRuntime(28343): at android.widget.Toast$TN.<init>(Toast.java:339)
10-12 17:02:55.500: E/AndroidRuntime(28343): at android.widget.Toast.<init>(Toast.java:98)
10-12 17:02:55.500: E/AndroidRuntime(28343): at android.widget.Toast.makeText(Toast.java:245)
10-12 17:02:55.500: E/AndroidRuntime(28343): at com.tongyan.activity.gps.SectionIndexAct$5.handleMessage(SectionIndexAct.java:503)
10-12 17:02:55.500: E/AndroidRuntime(28343): at com.tongyan.activity.gps.SectionIndexAct$9.run(SectionIndexAct.java:426)
10-12 17:02:55.500: E/AndroidRuntime(28343): at java.util.Timer$TimerImpl.run(Timer.java:284)
10-12 17:02:56.270: E/WindowManager(28343): Activity com.tongyan.activity.gps.SectionIndexAct has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{41525f48 V.E..... R......D 0,0-67,67} that was originally added here
10-12 17:02:56.270: E/WindowManager(28343): android.view.WindowLeaked: Activity com.tongyan.activity.gps.SectionIndexAct has leaked window com.android.internal.policy.impl.PhoneWindow$DecorView{41525f48 V.E..... R......D 0,0-67,67} that was originally added here
10-12 17:02:56.270: E/WindowManager(28343): at android.view.ViewRootImpl.<init>(ViewRootImpl.java:382)
10-12 17:02:56.270: E/WindowManager(28343): at android.view.WindowManagerGlobal.addView(WindowManagerGlobal.java:219)
10-12 17:02:56.270: E/WindowManager(28343): at android.view.WindowManagerImpl.addView(WindowManagerImpl.java:69)
10-12 17:02:56.270: E/WindowManager(28343): at android.app.Dialog.show(Dialog.java:281)
10-12 17:02:56.270: E/WindowManager(28343): at com.tongyan.activity.gps.SectionIndexAct.collectPoint(SectionIndexAct.java:392)
10-12 17:02:56.270: E/WindowManager(28343): at com.tongyan.activity.gps.SectionIndexAct$GpsSectionMenuListAdapter$1.onClick(SectionIndexAct.java:577)
10-12 17:02:56.270: E/WindowManager(28343): at android.view.View.performClick(View.java:4219)
10-12 17:02:56.270: E/WindowManager(28343): at android.view.View$PerformClick.run(View.java:17422)
10-12 17:02:56.270: E/WindowManager(28343): at android.os.Handler.handleCallback(Handler.java:725)
10-12 17:02:56.270: E/WindowManager(28343): at android.os.Handler.dispatchMessage(Handler.java:92)
10-12 17:02:56.270: E/WindowManager(28343): at android.os.Looper.loop(Looper.java:137)
10-12 17:02:56.270: E/WindowManager(28343): at android.app.ActivityThread.main(ActivityThread.java:5119)
10-12 17:02:56.270: E/WindowManager(28343): at java.lang.reflect.Method.invokeNative(Native Method)
10-12 17:02:56.270: E/WindowManager(28343): at java.lang.reflect.Method.invoke(Method.java:511)
10-12 17:02:56.270: E/WindowManager(28343): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:834)
10-12 17:02:56.270: E/WindowManager(28343): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:601)
10-12 17:02:56.270: E/WindowManager(28343): at dalvik.system.NativeStart.main(Native Method)
原因是你在子线程里去handleMessage了,至于具体分析,还请自行google
Android Exception 13(Can't create handler inside thread that has not called Looper.prepare())的更多相关文章
- Android进阶(八)Can't create handler inside thread that has not called Looper.prepare()
Error:Can't create handler inside thread that has not called Looper.prepare() 原代码: //利用Handler消息传递机制 ...
- Android 错误提示: Can't create handler inside thread that has not called Looper.prepare()
Can't create handler inside thread that has not called Looper.prepare() 将 Handler handler = new Hand ...
- Android 线程更新UI报错 : Can't create handler inside thread that has not called Looper.prepare()
MainActivity中有一个按钮,绑定了save方法 public void save(View view) { String title = titleText.getText().toStri ...
- Android handler 报错处理Can't create handler inside thread that has not called Looper.prepare()
问题: 写了一个sdk给其他人用,提供一个回调函数,函数使用了handler处理消息 // handler监听网络请求,完成后操作回调函数 final Handler trigerGfHandler ...
- Android进阶(十六)子线程调用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() 错误 今天用子线程调Toast报 ...
- 在子线程中new Handler报错--Can't create handler inside thread that has not called Looper.prepare()
在子线程中new一个Handler为什么会报以下错误? java.lang.RuntimeException: Can't create handler inside thread that has ...
- 关于子线程使用Toast报错Can't create handler inside thread that has not called Looper.prepare()的解决办法
形同如下代码,在Thread中调用Toast显示错误信息: new Thread(new Runnable(){ @Override public void run() { try{ weatherD ...
- Can’t create handler inside thread that has not called Looper.prepare()
1)在Android 2.3以前,为防止ANR(Application Not Responding),Google是不赞成将网络连接等一系列耗时操作直接放到应用主线程进行的,推荐将这类操作放在子线程 ...
- Android-java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
章出自:luchg技术交流 http://www.luchg.com 版权所有.本站文章除注明出处外,皆为作者原创文章,可自由引用,但请注明来源,谢谢. Android-java.lang.Runti ...
随机推荐
- Codeforces Round #277 (Div. 2) D. Valid Sets (DP DFS 思维)
D. Valid Sets time limit per test 1 second memory limit per test 256 megabytes input standard input ...
- Android异步消息处理机制(多线程)
当我们需要执行一些耗时操作,比如说发起一条网络请求时,考虑到网速等其他原因,服务器未必会立刻响应我们的请求,如果不将这类操作放在子线程里去执行,就会导致主线程被阻塞住,从而影响用户对软件的正常使用. ...
- [HDU1542]Atlantis(扫描线+线段树)
Atlantis Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 65536/32768 K (Java/Others)Total Su ...
- 【最短路】【位运算】It's not a Bug, it's a Feature!
[Uva658] It's not a Bug, it's a Feature! 题目略 UVA658 Problem PDF上有 试题分析: 本题可以看到:有<=20个潜在的BUG,那 ...
- 【概率DP】BZOJ4318-OSU!
[题目大意] 一共有n次操作,每次操作只有成功与失败之分,成功对应1,失败对应0,n次操作对应为1个长度为n的01串.在这个串中连续的 X个1可以贡献X^3 的分数,这x个1不能被其他连续的1所包含( ...
- 使用redis时出现java.util.ArrayList cannot be cast to java.lang.Long
java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Long at redis.clients. ...
- 一个简单的Spring程序
首先,要用Eclipse开发Spring程序,需要安装Spring插件并重启Eclipse 具体操作: 新建java Project后,导入需要使用的包(提前下好Spring),Spring包包含6个 ...
- [BZOJ1001](BeiJingOI 2006)狼抓兔子
Description Source: Beijing2006 [BJOI2006] 八中OJ上本题链接:http://www.lydsy.com/JudgeOnline/problem.php? ...
- git 推送内容到远程新分支
之前在做项目的时候,自己想将东西传到远程的一个新分支上.自己开始弄的时候稀里糊涂弄上去的也没搞清楚原理,不过自己后来又去试了一下,发现下面这个方法还可以. (1)在本地的一个目录下,git bash ...
- 用js给循环的列表添加click事件
纠结了两天终于搞定了,首先id这个东西必不可少,这个时候不能用onclik事件,而是需要使用代理事件. 比如说,这里有个列表如下: <ul> <li></li> & ...