一站式学习Redis 从入门到高可用分布式实践MK
download:一站式学习Redis 从入门到高可用分布式实践MK
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() {
}
/**
* Executes the request and returns PluginResult.
*
* @param actionThe action to execute.
* @param argsJSONArray of arguments for the plugin.
* @param callbackIdThe callback id used when calling back into JavaScript.
* @returnA PluginResult object with a status and message.
*/
@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文件中添加对新插件的配置信息
复制代码
【一站式学习Redis 从入门到高可用分布式实践MK】 新增的插件类配置 name 写你的类名,value写 包名.类名-->
复制代码
推荐阅读
- 由浅入深理解AOP
- 继续努力,自主学习家庭Day135(20181015)
- python学习之|python学习之 实现QQ自动发送消息
- 一起来学习C语言的字符串转换函数
- 定制一套英文学习方案
- 漫画初学者如何学习漫画背景的透视画法(这篇教程请收藏好了!)
- 《深度倾听》第5天──「RIA学习力」便签输出第16期
- 如何更好的去学习
- 【韩语学习】(韩语随堂笔记整理)
- 焦点学习田源分享第267天《来访》