2014-09-24 68 views
0

正如標題所說傳遞價值科爾多瓦

我有一個科爾多瓦插件class.I援引.......我的活動有一定的功能,發生在該活動class.Need到將該值返回給javascript界面​​。如何完成這項工作?

   Log.i("logger", "entered java code"); 

       JSONObject arg_object = args.getJSONObject(0); 
       Log.i("logger", "entered java code"); 

       MapValues mapValues=new MapValues(arg_object); 
       Log.i("logger", mapValues.toString()); 
       Activity context = this.cordova.getActivity(); 

       Intent intent=new Intent(context,MapsActivityConsumer.class); 
       Bundle mbBundle = new Bundle();      
       mbBundle.putParcelable("main_json_object_mapvalues_key", mapValues); 
       intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); 
       intent.putExtras(mbBundle); 
       context.startActivity(intent); 
       return true; 

回答

0

您可以嘗試使用它。

  this.appView.loadUrl("javascript:sendValuetoJS(\""+mapValues+"\");"); 

其中sendValuetoJS是要調用的方法名稱。在該方法中,您將返回Native的值。

我正在使用它從Native發送值到PhoneGap。