This is my plugin for android and one of my method requires a context, Is there a way how can I get this context?
public class GaziruPlugin extends CordovaPlugin{ @Override public boolean execute(String action, JSONArray args, CallbackContext callbackContext) throws JSONException { String value = args.getString(0); BASE64Decoder decoder = new BASE64Decoder(); try { byte[] imageByte = decoder.decodeBuffer(value); Classlogic method = new Classlogic(); //this method requires a context type. method.DoLogic(context,imageByte); } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } return false; }
}
I hope you can help me. Thanks
try to put this into your plugin:
Context context=this.cordova.getActivity().getApplicationContext();
1.4m articles
1.4m replys
5 comments
57.0k users