无法按下后退按钮上的Android活动

时间:2012-03-26 11:01:35

标签: android android-activity runtime-error

03-26 16:16:38.623: E/AndroidRuntime(5079): FATAL EXCEPTION: main
03-26 16:16:38.623: E/AndroidRuntime(5079): java.lang.RuntimeException: Unable to destroy activity {com.crack.Emobi/com.crack.Emobi.Main}: java.lang.NullPointerException
03-26 16:16:38.623: E/AndroidRuntime(5079):     at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3081)
03-26 16:16:38.623: E/AndroidRuntime(5079):     at android.app.ActivityThread.handleDestroyActivity(ActivityThread.java:3146)
03-26 16:16:38.623: E/AndroidRuntime(5079):     at android.app.ActivityThread.access$2100(ActivityThread.java:132)
03-26 16:16:38.623: E/AndroidRuntime(5079):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1071)
03-26 16:16:38.623: E/AndroidRuntime(5079):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-26 16:16:38.623: E/AndroidRuntime(5079):     at android.os.Looper.loop(Looper.java:150)
03-26 16:16:38.623: E/AndroidRuntime(5079):     at android.app.ActivityThread.main(ActivityThread.java:4263)
03-26 16:16:38.623: E/AndroidRuntime(5079):     at java.lang.reflect.Method.invokeNative(Native Method)
03-26 16:16:38.623: E/AndroidRuntime(5079):     at java.lang.reflect.Method.invoke(Method.java:507)
03-26 16:16:38.623: E/AndroidRuntime(5079):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
03-26 16:16:38.623: E/AndroidRuntime(5079):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
03-26 16:16:38.623: E/AndroidRuntime(5079):     at dalvik.system.NativeStart.main(Native Method)
03-26 16:16:38.623: E/AndroidRuntime(5079): Caused by: java.lang.NullPointerException
03-26 16:16:38.623: E/AndroidRuntime(5079):     at com.crack.Emobi.Main.onDestroy(Main.java:106)
03-26 16:16:38.623: E/AndroidRuntime(5079):     at android.app.ActivityThread.performDestroyActivity(ActivityThread.java:3063)
03-26 16:16:38.623: E/AndroidRuntime(5079):     ... 11 more

当我从我的Activity中退出(通过后退按钮)时,它会给出上述错误。 任何帮助都会让我感激。

1 个答案:

答案 0 :(得分:0)

您的NullPointerException方法中有onDestroy()

03-26 16:16:38.623: E/AndroidRuntime(5079): Caused by: java.lang.NullPointerException
03-26 16:16:38.623: E/AndroidRuntime(5079): at com.crack.Emobi.Main.onDestroy(Main.java:106)