Back to project page AndroidPad.
The source code is released under:
Apache License
If you think the Android project AndroidPad listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package com.fb.droidpad; //from w w w . ja v a2 s . com import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class JSONAction { private JSONObject json; public JSONAction(float eventX[], float eventY[], int motionEvent[]) throws JSONException { json = new JSONObject(); int length = eventX.length; JSONArray array = new JSONArray(); for (int i=0; i<length; i++) { JSONObject pointer = new JSONObject(); pointer.put("x", eventX[i]); pointer.put("y", eventY[i]); pointer.put("motionEvent", motionEvent[i]); array.put(pointer); } json.put("pointers", array); this.json = json; } public void setGesture(int id) throws JSONException { JSONObject gesture = new JSONObject(); gesture.put("type", id); json.put("gesture", gesture); } public String getJSON() { return this.json.toString(); } }