Skip to content Skip to sidebar Skip to footer

Android Onactivityresult: Attempt To Invoke Virtual Method On A Null Object Reference

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 activit

Solution 1:

You have to initialise callback context .may be you have declared it but haven't initialised as in : 1. Callbackcontext myvar; Myvar.mymethod

This will throw a null pointer because callbackcontext is declared but not initialized. 2. To fix the above you have to initialize.

Callbackcontext myvar =new callbackcontext;; Myvar.mymethod

Solution 2:

You haven't initialized the variable callbackContext. On your onCreate() method, you should initialize it, e.g. callbackContext = new CallbackContext() being CallbackContextthe class that corresponds to the type of callbackContext.

Post a Comment for "Android Onactivityresult: Attempt To Invoke Virtual Method On A Null Object Reference"