由网友(——念成伤)分享简介:这是我的插件Android和我的方法之一,需要一个背景下,有没有一种方法,我怎么能得到这样的背景下?This is my plugin for android and one of my method requires a context, Is there a way how can I get this cont...
这是我的插件Android和我的方法之一,需要一个背景下,有没有一种方法,我怎么能得到这样的背景下?
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();
相关推荐
最新文章