1JSONArray jArray = jObject.getJSONArray("layout");
2 layout = (LinearLayout) findViewById(R.id.statsviewlayout);
3
4 for (int i=0; i < jArray.length(); i++)
5 {
6 try {
7 JSONObject oneObject = jArray.getJSONObject(i);
8 // Pulling items from the array
9 String tag = oneObject.getString("tag");
10 String name= oneObject.getString("name");
11 String hint= oneObject.getString("hint");
12 Button button = new Button(this);
13 button.setText(name);
14 button.setLayoutParams(new LayoutParams(
15 ViewGroup.LayoutParams.WRAP_CONTENT,
16 ViewGroup.LayoutParams.WRAP_CONTENT));
17 layout.addView(buyButton);
18
19 } catch (JSONException e) {
20 // Oops
21 }
22 }
23