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 ...
随机推荐
- 查看所有shell类型
[xf@xuexi ~]$ cat /etc/shells /bin/sh /bin/bash /sbin/nologin /usr/bin/sh /usr/bin/bash /usr/sbin/no ...
- 【Java多线程】线程池学习
Java线程池学习 众所周知,Java不仅提供了线程,也提供了线程池库给我们使用,那么今天来学学线程池的具体使用以及线程池基本实现原理分析. ThreadPoolExecutor ThreadPool ...
- uva 10648(简单dp)
Recently one of my friend Tarik became a member of the food committee of an ACM regional competition ...
- 【BZOJ 2802】 2802: [Poi2012]Warehouse Store (贪心)
2802: [Poi2012]Warehouse Store Description 有一家专卖一种商品的店,考虑连续的n天.第i天上午会进货Ai件商品,中午的时候会有顾客需要购买Bi件商品,可以选择 ...
- String类的compareTo()和compareToIgnoreCase()
compareTo()的返回值是int,它是先比较对应字符的大小(ASCII码顺序) 1.如果字符串相等返回值0 2.如果第一个字符和参数的第一个字符不等,结束比较,返回他们之间的差值(ascii码值 ...
- Problem I: 零起点学算法104——Yes,I can!
#include<stdio.h> int main() { ]; while(gets(a)!=NULL) { printf("I am "); printf(&qu ...
- boost_1.63.0编译VS2013
编译 boost 库的步骤: 从官网下载最新版本的 boost 库(目前最新版本为:boost_1_63_0):下载地址:http://www.boost.org/users/download/ 解压 ...
- [转]java中JSONObject与JSONArray的使用详细说明及有关JSON的工具类
JSONObject与JSONArray的使用 一.JAR包简介 要使程序可以运行必须引入JSON-lib包,JSON-lib包同时依赖于以下的JAR包: 1.commons-lang.jar 2.c ...
- Manthan, Codefest 16 A. Ebony and Ivory 水题
A. Ebony and Ivory 题目连接: http://www.codeforces.com/contest/633/problem/A Description Dante is engage ...
- 18 个最佳代码编辑器/IDE推荐
本文为开发人员收录了18个最好的代码编辑器/IDE工具,希望你会喜欢. 1) chocolatapp Chocolat是最新出现的一款强大的Mac系统文本编辑器,兼具原生的Cocoa及强大的文本编辑功 ...