## download:Zookeeper源码分析
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 {
public static String ACTION = "hello";
public PluginTest() {
}
@Override
public PluginResult execute(String action, JSonArray args, String callbackId) {
try {
JSonObject jsonObj = new JSonObject();//能够返回给JS的JSON数据
if (action.equals("hello")) {
String str1= args.getString(0); //获取第一个参数
String str2= args.getString(1); //获取第二个参数
jsonObj.put("str1", str1+"1"); //把参数放到JSONObject对象中
jsonObj.put("str2", str2+"2"); //把参数放到JSONObject对象中
}
PluginResult r = new PluginResult(PluginResult.Status.OK,jsonObj);
return r;
} catch (Exception e) {
e.printStackTrace();
}
}
}
二、在plugins.xml中配置插件
在plugins.xml文件中添加对新插件的配置信息
新增的插件类配置 name 写你的类名,value写 包名.类名-->



