我的应用程序 android 崩溃了。
日志错误:
07-09 12:00:46.486: D/dalvikvm(249): GC freed 613 objects / 50984 bytes in 89ms
07-09 12:00:49.944: D/dalvikvm(249): GC freed 2700 objects / 118760 bytes in 76ms
07-09 12:00:50.406: D/AndroidRuntime(249): Shutting down VM
07-09 12:00:50.406: W/dalvikvm(249): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
07-09 12:00:50.417: E/AndroidRuntime(249): Uncaught handler: thread main exiting due to uncaught exception
07-09 12:00:50.444: E/AndroidRuntime(249): java.lang.RuntimeException: Unable to start activity ComponentInfo{allo.nascubetest/allo.nascubetest.MainActivity2}: java.lang.NullPointerException
07-09 12:00:50.444: E/AndroidRuntime(249): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2496)
07-09 12:00:50.444: E/AndroidRuntime(249): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2512)
07-09 12:00:50.444: E/AndroidRuntime(249): at android.app.ActivityThread.access$2200(ActivityThread.java:119)
07-09 12:00:50.444: E/AndroidRuntime(249): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1863)
07-09 12:00:50.444: E/AndroidRuntime(249): at android.os.Handler.dispatchMessage(Handler.java:99)
07-09 12:00:50.444: E/AndroidRuntime(249): at android.os.Looper.loop(Looper.java:123)
07-09 12:00:50.444: E/AndroidRuntime(249): at android.app.ActivityThread.main(ActivityThread.java:4363)
07-09 12:00:50.444: E/AndroidRuntime(249): at java.lang.reflect.Method.invokeNative(Native Method)
07-09 12:00:50.444: E/AndroidRuntime(249): at java.lang.reflect.Method.invoke(Method.java:521)
07-09 12:00:50.444: E/AndroidRuntime(249): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860)
07-09 12:00:50.444: E/AndroidRuntime(249): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618)
07-09 12:00:50.444: E/AndroidRuntime(249): at dalvik.system.NativeStart.main(Native Method)
07-09 12:00:50.444: E/AndroidRuntime(249): Caused by: java.lang.NullPointerException
07-09 12:00:50.444: E/AndroidRuntime(249): at allo.nascubetest.MainActivity2.onCreate(MainActivity2.java:111)
07-09 12:00:50.444: E/AndroidRuntime(249): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
07-09 12:00:50.444: E/AndroidRuntime(249): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2459)
07-09 12:00:50.444: E/AndroidRuntime(249): ... 11 more
07-09 12:00:50.454: I/dalvikvm(249): threadid=7: reacting to signal 3
07-09 12:00:50.554: I/dalvikvm(249): Wrote stack trace to '/data/anr/traces.txt'
07-09 12:00:52.084: I/Process(249): Sending signal. PID: 249 SIG: 9
在我的 OnCreate 中:
Intent thisIntent = getIntent();
date = thisIntent.getExtras().getString("date");
和我的第 111 行:
labelDate.setText(date);