download:Go开发工程师:迎接回升风口,踏入蓝海行业
import org.json.JSONArray;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ActivityNotFoundException;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import com.phonegap.api.PhonegapActivity;
import com.phonegap.api.Plugin;
import com.phonegap.api.PluginResult;
public class PluginTest extends Plugin {
在HTML文件中调用方法
在html文件中引入phonegap和插件的js文件,调用方法
复制代码
<html>
<head><meta charset="utf-8"><title>JAVA传参</title><script src="phonegap.js"></script> phonegap包--><script src="js/jquery.js"></script><script src="simplePlugin.js"></script>自定义的插件文件--><script> $(document).ready(function(e) { $("#btn_test").click(function(){ window.plugins.simplePlugin.hello( function(result) { alert("返回的第一个参数:"+result.str1+"返回的第二个参数"+result.str2); }, function(error) { }, "第一个参数", "第二个参数" ); });});</script></head>
<body>
<button type="button" id="btn_test">Click Me!</button>
</body>
</html>
复制代码