목록보기에서 인쇄 된 json 응답이 있습니다. json의 값이 인쇄되지만 모든 값이 올바르게 인쇄되지 않습니다. 일부 json 값은 잘못된 위치에 인쇄됩니다.JSON 응답이 제대로 안드로이드에서 인쇄되지 않습니다.
JSON 응답 :
```
[
{
"HouseNo":"33333333",
"AreaName":"ghfhgfhg",
"Landmark":"",
},
{
"HouseNo":"33333333",
"AreaName":"gfhgfh",
"Landmark":"",
}
]
``
이 특정 값 페치 코드 :
StringRequest stringRequest = new StringRequest(Request.Method.POST,url,
new Response.Listener<String>() {
@Override
public void onResponse(String response) {
Log.d(TAG, response.toString());
hidePDialog();
try {
JSONArray jsonarray = new JSONArray(response);
for (int i = 0; i < jsonarray.length(); i++) {
JSONObject obj = jsonarray.getJSONObject(i);
Customer customer = new Customer();
customer.setTitle(obj.getString("HouseNo"));
customer.setSerial(obj.getString("AreaName"));
customer.setService(obj.getString("Landmark"));
customerList.add(customer);
}
} catch (JSONException e) {
e.printStackTrace();
}
// notifying list adapter about data changes
// so that it renders the list view with updated data
adapter.notifyDataSetChanged();
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
VolleyLog.d(TAG, "Error: " + error.getMessage());
hidePDialog();
}
})
일부 확인 응답을 인쇄하는 단계; 그러나 일부 응답 대신 인쇄 된 다른 응답을 인쇄합니다.이 문제를 해결하는 방법?
어댑터 코드 표시 – Vickyexpert
또한 고객 모델 클래스 추가 – Pavya