使用Intent的活动会抛出Null指针异常

时间:2014-03-03 04:44:54

标签: android facebook android-intent android-activity

 case R.id.action_logout:
            Intent offer = new Intent(context,OfferDetailActivity.class);
            //offer.addFlags(offer.FLAG_ACTIVITY_BROUGHT_TO_FRONT);
            FacebookHelper.logoutUser(this);
            startActivity(offer);

上面提到的代码导致错误并强制关闭应用程序我无法理解错误 logcat显示在错误

下面
03-03 10:06:51.590: D/AndroidRuntime(8707): Shutting down VM
03-03 10:06:51.590: W/dalvikvm(8707): threadid=1: thread exiting with uncaught exception     (group=0x40018578)
03-03 10:06:51.590: E/AndroidRuntime(8707): FATAL EXCEPTION: main
03-03 10:06:51.590: E/AndroidRuntime(8707): java.lang.RuntimeException: Unable to start activity     ComponentInfo{com.cartperk.android.cartperk/com.cartperk.android.cartperk.ui.OfferDetailActivity}: java.lang.NullPointerException
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1651)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1667)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:935)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.os.Handler.dispatchMessage(Handler.java:99)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.os.Looper.loop(Looper.java:123)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.app.ActivityThread.main(ActivityThread.java:3687)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at java.lang.reflect.Method.invokeNative(Native Method)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at java.lang.reflect.Method.invoke(Method.java:507)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:867)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:625)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at dalvik.system.NativeStart.main(Native Method)
03-03 10:06:51.590: E/AndroidRuntime(8707): Caused by: java.lang.NullPointerException
03-03 10:06:51.590: E/AndroidRuntime(8707):     at com.cartperk.android.cartperk.ui.OfferDetailFragment.onActivityCreated(OfferDetailFragment.java:92)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.support.v4.app.Fragment.performActivityCreated(Fragment.java:1508)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:947)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1104)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1086)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.support.v4.app.FragmentManagerImpl.dispatchActivityCreated(FragmentManager.java:1884)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.support.v4.app.FragmentActivity.onStart(FragmentActivity.java:566)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.app.Instrumentation.callActivityOnStart(Instrumentation.java:1129)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.app.Activity.performStart(Activity.java:3791)
03-03 10:06:51.590: E/AndroidRuntime(8707):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1624)
03-03 10:06:51.590: E/AndroidRuntime(8707):     ... 11 more

谢谢

0 个答案:

没有答案