0
related_ids 배열의 데이터를 검색하려고하지만 실패합니다. 내 코드는 배열의 각 값을 따로 제공하지 않습니다.json을 통해 배열 데이터 검색
{
"title": "Prod"
"related_ids": [3]
0: 4323
1: 4321
2: 4317
"tags": [0]
}
이것은 내 코드입니다.
JSONArray jsonArray = response.getJSONArray("showProductListResponse");
for (int i = 0; i < jsonArray.length(); i++) {
try {
JSONObject obj = jsonArray.getJSONObject(i);
HomelList productListItems = new HomelList();
productListItems.setName(obj.getString("title"));
try {
JSONArray relatedimages = obj.getJSONArray("related_ids");
for (int j = 0; j < relatedimages.length(); j++) {
JSONObject relimagesObject = relatedimages.getJSONObject(j);
productListItems.setRelatedids(relimagesObject.getInt(relimagesObject.indexOf[j]);
}
} catch (JSONException e) {
e.printStackTrace();
}
gavkidata.add(productListItems);
adapter.notifyDataSetChanged();
} catch (JSONException e) {
e.printStackTrace();
}
}