Getting a NPE at onActivityResult after Facebook login in my app. Seems to work fine with most users,but some users are reporting this problem. I am using SDK 3.5.2.
java.lang.RuntimeException: Unable to resume activity {------------}: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64206, result=0, data=Intent { (has extras) }} to activity {----------------------------------}: java.lang.NullPointerException at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3170) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3185) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.access$2300(ActivityThread.java:132) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4669) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64206, result=0, data=Intent { (has extras) }} to activity {-----------------------}: java.lang.NullPointerException at android.app.ActivityThread.deliverResults(ActivityThread.java:3557) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3157) ... 12 more Caused by: java.lang.NullPointerException at -----------------------------(LogIn.java:720) at android.app.Activity.dispatchActivityResult(Activity.java:3905) at android.app.ActivityThread.deliverResults(ActivityThread.java:3553) ... 13 more java.lang.RuntimeException: Failure delivering result ResultInfo{who=null, request=64206, result=0, data=Intent { (has extras) }} to activity {----------------------------------}: java.lang.NullPointerException at android.app.ActivityThread.deliverResults(ActivityThread.java:3557) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3157) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3185) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.access$2300(ActivityThread.java:132) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4669) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) at dalvik.system.NativeStart.main(Native Method) Caused by: java.lang.NullPointerException at ------------------------------------(LogIn.java:720) at android.app.Activity.dispatchActivityResult(Activity.java:3905) at android.app.ActivityThread.deliverResults(ActivityThread.java:3553) ... 13 more java.lang.NullPointerException at ------------------------------------(LogIn.java:720) at android.app.Activity.dispatchActivityResult(Activity.java:3905) at android.app.ActivityThread.deliverResults(ActivityThread.java:3553) at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3157) at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3185) at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2726) at android.app.ActivityThread.access$2300(ActivityThread.java:132) at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2071) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:123) at android.app.ActivityThread.main(ActivityThread.java:4669) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:521) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:876) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:634) at dalvik.system.NativeStart.main(Native Method)
Here is my code on this line.
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data){
super.onActivityResult(requestCode, resultCode, data);
Session.getActiveSession().onActivityResult(this, requestCode, resultCode , data);
onActivityResult = true;
}
// [START onActivityResult]
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) { // Taken
super.onActivityResult(requestCode, resultCode, data);
if(resultCode != RESULT_CANCELED&&resultCode != RESULT_CANCELED) {
mCallbackManager.onActivityResult(requestCode, resultCode, data);
}// Result returned from launching the Intent from GoogleSignInApi.getSignInIntent(...);
if (requestCode == RC_SIGN_IN) {
GoogleSignInResult result = Auth.GoogleSignInApi.getSignInResultFromIntent(data);
handleSignInResult(result);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.