java - Failure Delivering Result on onActivityResult method -


currently trying call app main app, here short diagram :

app a -> send task code app b -> app b (do task)
app b -> (return result app a) -> app a

here how app call app b , send task code :

private void attemptfacialrecognition(){     intent intent = new intent();     intent.setaction("com.yai.facerecognitionapp.facial_recognition");      if(intent != null){         // found activity         intent.addflags(intent.flag_activity_clear_when_task_reset);          // 0x10000000 = login         intent.putextra(flag_acvity_task, flag_activity_login);         loginactivity.this.startactivityforresult(intent, flag_request_code);     } } 

here manifest on app b :

<application     android:hardwareaccelerated="true"     android:allowbackup="true"     android:icon="@mipmap/ic_launcher"     android:label="@string/app_name"     android:supportsrtl="false"     android:theme="@style/apptheme">     <activity android:name="com.yai.facerecognitionapp.facerecognitionappactivity"         android:screenorientation="portrait"         android:label="@string/app_name"         android:theme="@style/apptheme.noactionbar">         <intent-filter>             <action android:name="android.intent.action.main" />             <category android:name="android.intent.category.launcher" />         </intent-filter>         <intent-filter>             <action android:name="com.yai.facerecognitionapp.facial_recognition" />             <category android:name="android.intent.category.default" />         </intent-filter>     </activity> </application> 

here app b returning result app :

private void resultactivity(boolean result){     intent intent = new intent();     intent.putextra(flag_acvity_result, result);     intent.putextra(flag_acvity_task, task);      setresult(activity.result_ok, intent);      finish(); } 

and here how app result app b :

@override protected void onactivityresult(int requestcode, int resultcode, intent data) {     super.onactivityresult(requestcode, resultcode, data);      if(requestcode == flag_request_code && resultcode == result_ok && data != null){         log.e("xxx", " " + requestcode + " " + resultcode);          bundle bundle = data.getextras();         if(bundle != null){             boolean res = data.getbooleanextra(flag_acvity_result, false);             log.e("xxx", res);         } 

every time try getstringextra, returning null pointer exception. here log cat :

fatal exception: main process: com.yai.xdbg, pid: 32202 java.lang.runtimeexception: failure delivering result resultinfo{who=null, request=777, result=-1, data=intent { (has extras) }} activity {com.yai.xdbg/com.yai.xdbg.loginactivity}: java.lang.nullpointerexception: println needs message   @ android.app.activitythread.deliverresults(activitythread.java:3646)   @ android.app.activitythread.handlesendresult(activitythread.java:3689)   @ android.app.activitythread.access$1300(activitythread.java:151)   @ android.app.activitythread$h.handlemessage(activitythread.java:1362)   @ android.os.handler.dispatchmessage(handler.java:102)   @ android.os.looper.loop(looper.java:135)   @ android.app.activitythread.main(activitythread.java:5345)   @ java.lang.reflect.method.invoke(native method)   @ java.lang.reflect.method.invoke(method.java:372)   @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:947)   @ com.android.internal.os.zygoteinit.main(zygoteinit.java:742) caused by: java.lang.nullpointerexception: println needs message   @ android.util.log.println_native(native method)   @ android.util.log.e(log.java:232)   @ com.yai.xdbg.loginactivity.onactivityresult(loginactivity.java:162)   @ android.app.activity.dispatchactivityresult(activity.java:6226)   @ android.app.activitythread.deliverresults(activitythread.java:3642)   @ android.app.activitythread.handlesendresult(activitythread.java:3689)    @ android.app.activitythread.access$1300(activitythread.java:151)    @ android.app.activitythread$h.handlemessage(activitythread.java:1362)    @ android.os.handler.dispatchmessage(handler.java:102)    @ android.os.looper.loop(looper.java:135)    @ android.app.activitythread.main(activitythread.java:5345)    @ java.lang.reflect.method.invoke(native method)    @ java.lang.reflect.method.invoke(method.java:372)    @ com.android.internal.os.zygoteinit$methodandargscaller.run(zygoteinit.java:947)    @ com.android.internal.os.zygoteinit.main(zygoteinit.java:742)  

what missed out? cannot figure out , many read , no 1 doesn't works. have tried different way , still stuck on problem.

thanks.


Comments

Popular posts from this blog

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

python Tkinter Capturing keyboard events save as one single string -

sql server - Why does Linq-to-SQL add unnecessary COUNT()? -