如何解决致命异常

时间:2011-03-30 12:32:19

标签: android

    WARN/dalvikvm(4645): threadid=7: thread exiting with uncaught exception (group=0x4001d800)
    ERROR/AndroidRuntime(4645): FATAL EXCEPTION: Timer-0
    ERROR/AndroidRuntime(4645): java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare()
    ERROR/AndroidRuntime(4645):     at android.os.Handler.<init>(Handler.java:121)
    ERROR/AndroidRuntime(4645):     at android.widget.Toast.<init>(Toast.java:68)
    ERROR/AndroidRuntime(4645):     at android.widget.Toast.makeText(Toast.java:231)
    ERROR/AndroidRuntime(4645):     at com.example.Task.jokedescription$1.run(jokedescription.java:186)
    ERROR/AndroidRuntime(4645):     at java.util.Timer$TimerImpl.run(Timer.java:289)
    WARN/ActivityManager(59):   Force finishing activity com.example.Task/.jokedescription

1 个答案:

答案 0 :(得分:5)

您正尝试向主(UI)线程显示Toast。

请发布您有异常的代码片段。