1
Volley를 사용하여 API를 호출하려고합니다. 다중 객체 요청이 있으므로 적절한 방법을 모르겠습니다. 나는 아래와 같이 코드를 만들려고했다. 그러나 그것은 나에게 응답을주지 않는다. 누군가는 나를 도와 줄 수 있냐? ???발리 안드로이드를 사용하여 복수 오브젝트 요청
MainActivity
public void getJsonResponsePost(){
JSONObject jsonData = new JSONObject();
JSONObject json = new JSONObject();
/*{"data":{"lang_type":"1","keyword":"","latitude":23.022499999999997,"longitude":72.57139833333333,"category":6}}*/
try {
jsonData.put("data",json);
json.put("lang_type","1");
json.put("keyword","");
json.put("latitude",23.022499999999997);
json.put("longitude",72.57139833333333);
json.put("category",6);
Log.d("TAG",jsonData.toString());
} catch (JSONException e) {
e.printStackTrace();
}
JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url, json, new Response.Listener<JSONObject>() {
@Override
public void onResponse(JSONObject response)
{
Log.d("String Response :",response.toString());
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.d(" Error getting :",error.toString());
}
});
jsonObjectRequest.setTag(REQ_TAG);
requestQueue.add(jsonObjectRequest);
}
나는 다음과 같은 응답
String Response :: {"status":"0","message":"Please pass the language type."}
여기 API 코드 –
은 내 코드에 어떤 실수가 있습니까 ?? plz 설명 할 수 있습니까? –
'lang_type'이 노드를 보니 api가 물어 보는 것과 똑같습니다 .. –