Dinámicamente vincula diseños Android con JSON Array
JSONArray jArray = jObject.getJSONArray("layout");
layout = (LinearLayout) findViewById(R.id.statsviewlayout);
for (int i=0; i < jArray.length(); i++)
{
try {
JSONObject oneObject = jArray.getJSONObject(i);
// Pulling items from the array
String tag = oneObject.getString("tag");
String name= oneObject.getString("name");
String hint= oneObject.getString("hint");
Button button = new Button(this);
button.setText(name);
button.setLayoutParams(new LayoutParams(
ViewGroup.LayoutParams.WRAP_CONTENT,
ViewGroup.LayoutParams.WRAP_CONTENT));
layout.addView(buyButton);
} catch (JSONException e) {
// Oops
}
}
Bored Badger