I assume that you defined a Point
class. The idea would be to loop through the array A
to take each subarray and for each one create a new Point
object.
public void testSendText() throws JSONException {
JSONObject jsonObj = new JSONObject(jsonString);
JSONArray jsonArr = jsonObj.getJSONArray("A"); //get array A
Vector<Point> apoints = new Vector<Point>();
for(int k = 0; k < jsonArr.length(); k++ ){
JSONArray arr = jsonArr.getJSONArray(k);
apoints.add(new Point(arr.getInt(0), arr.getInt(1)));
}
getUiDevice().swipe(apoints.toArray(new Point[apoints.size()]), 5);
}
Output :
01-22 00:50:52.677: I/System.out(568):
[Point [x=107, y=729], Point [x=108, y=728], Point [x=108, y=728],
Point [x=108, y=727], Point [x=108, y=727], Point [x=108, y=727],
Point [x=108, y=727], Point [x=108, y=727], Point [x=108, y=727],
Point [x=108, y=727], Point [x=108, y=727], Point [x=108, y=727],
Point [x=110, y=724], Point [x=114, y=717], Point [x=125, y=701],
Point [x=134, y=685], Point [x=145, y=663], Point [x=157, y=636],
Point [x=169, y=607], Point [x=179, y=583], Point [x=191, y=558],
Point [x=196, y=547], Point [x=199, y=540], Point [x=201, y=534],
Point [x=202, y=529], Point [x=203, y=528], Point [x=204, y=525],
Point [x=204, y=524], Point [x=204, y=524], Point [x=204, y=524],
Point [x=204, y=524], Point [x=204, y=524], Point [x=204, y=525],
Point [x=204, y=530], Point [x=205, y=538], Point [x=207, y=549],
Point [x=209, y=566], Point [x=216, y=602], Point [x=223, y=629],
Point [x=229, y=653], Point [x=235, y=671], Point [x=238, y=684],
Point [x=241, y=697], Point [x=242, y=703], Point [x=242, y=707],
Point [x=243, y=710], Point [x=243, y=712], Point [x=243, y=713],
Point [x=243, y=713], Point [x=243, y=713], Point [x=243, y=713],
Point [x=244, y=713], Point [x=244, y=713], Point [x=244, y=713],
Point [x=244, y=713], Point [x=242, y=709], Point [x=237, y=703],
Point [x=230, y=695], Point [x=224, y=684], Point [x=220, y=679],
Point [x=215, y=671], Point [x=212, y=665], Point [x=206, y=658],
Point [x=202, y=655], Point [x=200, y=654], Point [x=196, y=651],
Point [x=192, y=648], Point [x=189, y=646], Point [x=184, y=642],
Point [x=182, y=641], Point [x=180, y=639], Point [x=179, y=637],
Point [x=177, y=635], Point [x=176, y=634], Point [x=174, y=633],
Point [x=173, y=631], Point [x=172, y=630], Point [x=171, y=629],
Point [x=170, y=628], Point [x=170, y=628], Point [x=170, y=627],
Point [x=169, y=627], Point [x=169, y=627], Point [x=169, y=627],
Point [x=169, y=627], Point [x=169, y=629], Point [x=169, y=629]]