这是我的LogCat日志:
07-17 14:05:10.226: INFO/ActivityManager(71): Starting activity: Intent { cmp=com.mohit.gtd/.TaskEdit }
07-17 14:05:10.316: VERBOSE/GTDActivity(579): Starting TaskEdit activity
07-17 14:05:10.576: DEBUG/PhoneWindow(579): couldn't save which view has focus because the focused view com.android.internal.policy.impl.PhoneWindow$DecorView@43e477b0 has no id.
07-17 14:05:10.775: DEBUG/AndroidRuntime(579): Shutting down VM
07-17 14:05:10.785: WARN/dalvikvm(579): threadid=1: thread exiting with uncaught exception (group=0x4001d800)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): FATAL EXCEPTION: main
07-17 14:05:10.825: ERROR/AndroidRuntime(579): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.mohit.gtd/com.mohit.gtd.TaskEdit}: java.lang.NullPointerException
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2663)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2679)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at android.app.ActivityThread.access$2300(ActivityThread.java:125)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2033)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at android.os.Handler.dispatchMessage(Handler.java:99)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at android.os.Looper.loop(Looper.java:123)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at android.app.ActivityThread.main(ActivityThread.java:4627)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at java.lang.reflect.Method.invokeNative(Native Method)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at java.lang.reflect.Method.invoke(Method.java:521)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at dalvik.system.NativeStart.main(Native Method)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): Caused by: java.lang.NullPointerException
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at com.mohit.gtd.TaskEdit.onCreate(TaskEdit.java:18)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2627)
07-17 14:05:10.825: ERROR/AndroidRuntime(579): ... 11 more
07-17 14:05:10.875: WARN/ActivityManager(71): Force finishing activity com.mohit.gtd/.TaskEdit
07-17 14:05:10.916: WARN/ActivityManager(71): Force finishing activity com.mohit.gtd/.GtdActivity
07-17 14:05:11.426: WARN/ActivityManager(71): Activity pause timeout for HistoryRecord{43fb2be0 com.mohit.gtd/.TaskEdit}
07-17 14:05:13.625: INFO/Process(579): Sending signal. PID: 579 SIG: 9
07-17 14:05:13.775: INFO/ActivityManager(71): Process com.mohit.gtd (pid 579) has died.
07-17 14:05:13.835: INFO/WindowManager(71): WIN DEATH: Window{43fd4e70 com.mohit.gtd/com.mohit.gtd.GtdActivity paused=true}
07-17 14:05:13.976: WARN/InputManagerService(71): Got RemoteException sending setActive(false) notification to pid 579 uid 10032
07-17 14:05:22.884: WARN/ActivityManager(71): Activity destroy timeout for HistoryRecord{43e46998 com.mohit.gtd/.GtdActivity}
07-17 14:05:23.069: WARN/ActivityManager(71): Activity destroy timeout for HistoryRecord{43fb2be0 com.mohit.gtd/.TaskEdit}
可能导致错误的原因是什么? TaskEdit
是Activity
的子类,它在AndroidManifest
文件中列为活动。
答案 0 :(得分:4)
您正在使用TaskEdit.java:18
中的NPE。
那里有什么?