List of usage examples for android.view MotionEvent getPointerProperties
public final void getPointerProperties(int pointerIndex, PointerProperties outPointerProperties)
From source file:Main.java
public static JSONObject CreateJSonObjectFromMotionEvent(MotionEvent e) throws JSONException { JSONObject jObj = new JSONObject(); jObj.put("downTime", e.getDownTime()); jObj.put("eventTime", e.getEventTime()); jObj.put("action", e.getAction()); jObj.put("pointerCount", e.getPointerCount()); jObj.put("metaState", e.getMetaState()); jObj.put("buttonState", e.getButtonState()); jObj.put("xPrecision", e.getXPrecision()); jObj.put("yPrecision", e.getYPrecision()); jObj.put("deviceId", e.getDeviceId()); jObj.put("edgeFlags", e.getEdgeFlags()); jObj.put("source", e.getSource()); jObj.put("flags", e.getFlags()); for (int i = 0; i < e.getPointerCount(); i++) { PointerProperties prop = new PointerProperties(); e.getPointerProperties(i, prop); PointerCoords coords = new PointerCoords(); e.getPointerCoords(i, coords);//from w w w. j av a2 s . c o m JSONObject pointer = JObjFromPointer(prop, coords); jObj.accumulate("pointers", pointer); } return jObj; }