Android Exception (Can ' t create handler inside thread that have not called looper.prepare ())

Source: Internet
Author: User

10-12 17:02:55.500:e/androidruntime (28343): FATAL exception:timer-210-12 17:02:55.500:e/androidruntime (28343): Java.lang.RuntimeException:Can ' t create handler inside thread that have not called looper.prepare () 10-12 17:02:55.500:e/a Ndroidruntime (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 is originally added here10-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 Here10-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)

The reason is that you go to the Handlemessage in the sub-thread, as for the specific analysis, also please Google

Android Exception (Can ' t create handler inside thread that have not called looper.prepare ())

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.