我试图从互联网上下载一个xml文件,但每次尝试时应用程序都会关闭....这是我的日志

时间:2012-07-16 09:07:54

标签: java android

07-16 14:32:17.052: E/Trace(1193): error opening trace file: No such file or directory (2)

07-16 14:32:17.562: I/Choreographer(1193): Skipped 48 frames!  The application may be doing too much work on its main thread.

07-16 14:32:17.732: D/gralloc_goldfish(1193): Emulator without GPU emulation detected.
07-16 14:32:20.272: D/AndroidRuntime(1193): Shutting down VM

07-16 14:32:20.272: W/dalvikvm(1193): threadid=1: thread exiting with uncaught exception (group=0x40a13300)

07-16 14:32:20.312: E/AndroidRuntime(1193): FATAL EXCEPTION: main

07-16 14:32:20.312: E/AndroidRuntime(1193): java.lang.IllegalStateException: Could not execute method of the activity

07-16 14:32:20.312: E/AndroidRuntime(1193):     at android.view.View$1.onClick(View.java:3591)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at 
android.view.View.performClick(View.java:4084)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at android.view.View$PerformClick.run(View.java:16966)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at android.os.Handler.handleCallback(Handler.java:615)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at android.os.Handler.dispatchMessage(Handler.java:92)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at android.os.Looper.loop(Looper.java:137)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at android.app.ActivityThread.main(ActivityThread.java:4745)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at java.lang.reflect.Method.invokeNative(Native Method)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at java.lang.reflect.Method.invoke(Method.java:511)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at 
com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at dalvik.system.NativeStart.main(Native Method)

07-16 14:32:20.312: E/AndroidRuntime(1193): Caused by: java.lang.reflect.InvocationTargetException

07-16 14:32:20.312: E/AndroidRuntime(1193):     at java.lang.reflect.Method.invokeNative(Native Method)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at java.lang.reflect.Method.invoke(Method.java:511)

07-16 14:32:20.312: E/AndroidRuntime(1193):     at android.view.View$1.onClick(View.java:3586)

07-16 14:32:20.312: E/AndroidRuntime(1193):     ... 11 more

07-16 14:32:20.312: E/AndroidRuntime(1193): Caused by: java.lang.NullPointerException

07-16 14:32:20.312: E/AndroidRuntime(1193):     at com.example.xmlparse.XML_parse.download(XML_parse.java:47)

07-16 14:32:20.312: E/AndroidRuntime(1193):     ... 14 more

07-16 14:32:22.542: I/Process(1193): Sending signal. PID: 1193 SIG: 9

2 个答案:

答案 0 :(得分:0)

07-16 14:32:20.312:E / AndroidRuntime(1193):引起:java.lang.NullPointerException 07-16 14:32:20.312:E / AndroidRuntime(1193):at com.example.xmlparse.XML_parse.download(XML_parse.java:47)

似乎你的XML是空的

答案 1 :(得分:0)

1。我认为你正在对你的UI线程进行工作,离开你的UI线程,然后执行此操作    在使用处理程序的非UI线程上,或使用AsyncTask

2。请确保您使用No-typos正确编写了目标XML,因为它无法到达目标,因为它是null。