how toget json array withour filter by name
how to get json array object from json array this code show only "title"
mVal[k] = school.getJSONObject(k).getString("title"); i want to wtite all
four element in fson file in textbox "title", "start_date", "end_date"
Json
{
"status":1,
"data":
[
{"schedule_id":"1",
"title":"semester 2",
"start_date":"2013-07-01 00:00:00",
"end_date":"2013-12-31 00:00:00"
}
]
}
Code
JSONObject json2 = new JSONObject(str);
status = json2.getString("status");
if (status.equals("1")) {
JSONArray school = json2.getJSONArray("data");
String[] mVal = new String[school.length()];
for (int k = 0; k < school.length(); k++) {
mVal[k] = school.getJSONObject(k).getString("title");
menu_nametxt1.setText(mVal[0]);
menu_nametxt2.setText(mVal[1]);
menu_nametxt3.setText(mVal[2]
}
No comments:
Post a Comment