2010-07-17 136 views
3

這是我的logcat日誌:的Android無法啓動活動

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 [email protected] 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} 

什麼引起的錯誤? TaskEditActivity的一個子類,它在AndroidManifest文件中列爲活動。

+1

查找錯誤堆棧跟蹤中的「原因:行」。它會給你錯誤,拋出錯誤的類和違規代碼的行參考。 – m6tt 2010-07-17 14:31:26

回答

4

您在TaskEdit.java:18中擁有NPE。

那裏有什麼?

+0

我發現這個問題,它是:id = savedInstanceState!= null? savedInstanceState.getLong(「id」):null。 – 2010-07-17 16:08:46

相關問題