Code example for JSONArray

Methods: put, toString

0
	 
	/** 
	 * Load Graph data 
	 */ 
	private void loadGraph(JSONArray data) {
		JSONArray arr = new JSONArray();
 
		JSONObject result = new JSONObject();
			 try { 
				result.put("data", data);//will ultimately look like: {"data": p[x1,y1],[x2,y2],[x3,y3],[]....]},
				result.put("lines", getLineOptionsJSON()); // { "lines": { "show" : true }},
				result.put("points", getPointOptionsJSON()); // { "points": { "show" : true }}
			} catch (JSONException e) {
				Log.d(this.getClass().getSimpleName(), "Got an exception while trying to parse JSON");
				e.printStackTrace();
			}  
			arr.put(result);
			 
		// return arr.toString(); //This _WILL_ return the data in a good looking JSON string, but if you pass it straight into the Flot Plot method, it will not work! 
			Log.d(this.getClass().getSimpleName(), arr.toString());
		mAppView.loadUrl("javascript:GotGraph(" + arr.toString() + ")"); // this callback works!
	} 
 
	/** 
	 * Get Points action 
	 * @return