JSON에서 값을 검색하려고하는데 responseString이 비어 있습니다. 여기org.json.JSONException : 안드로이드의 문자 0에서 입력 끝
다음HttpClient httpClient = new DefaultHttpClient();
HttpContext httpContext = new BasicHttpContext();
HttpPost httpPost = new HttpPost(URL);
String jsons = "";
JSONObject jsonObject = new JSONObject();
jsonObject.put("tbl_id", tableid);
jsonObject.put("imei_no", phneimeino);
jsonObject.put("server_id", usrid);
jsonObject.put("customers", customerName1 + "," + customerName2 + "," + customerName3);
Log.w("JSON OBJECT is ", jsonObject.toString());
jsons = jsonObject.toString();
StringEntity se = new StringEntity(jsons);
httpPost.setEntity(se);
httpPost.setHeader("Accept", "application/json");
httpPost.setHeader("Content-type", "application/json");
HttpResponse response = httpClient.execute(httpPost, httpContext);
HttpEntity entity = response.getEntity();
String responseString = EntityUtils.toString(entity);
Log.i("Response", responseString);
JSONObject json = new JSONObject(responseString);
success = json.getString("iserror");
responseString 내 코드 비어이며, 당신은 아마 빈 반응을 얻고있다
org.json.JSONException: End of input at character 0 of
응답 서비스 방법은 get 또는 post 방법입니까? 서비스를 확인하십시오. – prakash
'responseString'을 출력하고 그것이 유효한지 확인하십시오 json –
I 응답 된 문자열을 인쇄했으나 비어 있습니다 –