im developing plugin for cordova android. it open up a custom activity and return sets of data back to the plugin.
all things are running well on the activity. but when the activity finished, it crashed and give me this error:
Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.success(java.lang.String)' on a null object reference
E/AndroidRuntime( 2697): at android.app.ActivityThread.deliverResults(ActivityThread.java:3539)
E/AndroidRuntime( 2697): at android.app.ActivityThread.handleSendResult(ActivityThread.java:3582)
E/AndroidRuntime( 2697): at android.app.ActivityThread.access$1300(ActivityThread.java:144)
E/AndroidRuntime( 2697): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1327)
E/AndroidRuntime( 2697): at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime( 2697): at android.os.Looper.loop(Looper.java:135)
E/AndroidRuntime( 2697): at android.app.ActivityThread.main(ActivityThread.java:5221)
E/AndroidRuntime( 2697): at java.lang.reflect.Method.invoke(Native Method)
E/AndroidRuntime( 2697): at java.lang.reflect.Method.invoke(Method.java:372)
E/AndroidRuntime( 2697): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:899)
E/AndroidRuntime( 2697): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:694)
E/AndroidRuntime( 2697): Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void org.apache.cordova.CallbackContext.success(java.lang.String)' on a null object reference
E/AndroidRuntime( 2697): at com.faiz.faizOk.onActivityResult(faizOk.java:147)
E/AndroidRuntime( 2697): at org.apache.cordova.CordovaInterfaceImpl.onActivityResult(CordovaInterfaceImpl.java:151)
E/AndroidRuntime( 2697): at org.apache.cordova.CordovaActivity.onActivityResult(CordovaActivity.java:348)
E/AndroidRuntime( 2697): at android.app.Activity.dispatchActivityResult(Activity.java:6139)
E/AndroidRuntime( 2697): at android.app.ActivityThread.deliverResults(ActivityThread.java:3535)
E/AndroidRuntime( 2697):
... 10 more
this is my android onActivityResult
method
@Override
public void onActivityResult(int requestCode, int resultCode, Intent data) {
System.out.println("finished native activity proceess...");
String message = " :finished activity from native: ";
callbackContext.success(message);
}