0
다음 코드는 아무 것도 반환하지 않습니다 .... 공란. DB에 레코드를 삽입하려고합니다.안드로이드 putJSON 아무것도 반환하지 않습니다
public String inserComment(String url, String commentby, String commenton, String commenttext, String taskid)
{
String result = null;
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("CommentBy", commentby);
jsonObject.put("CommentOn", commenton);
jsonObject.put("CommentText", commenttext);
jsonObject.put("TaskID", taskid);
result = HttpHelper.postJSONforStringResult(url, jsonObject);
} catch (JSONException e) {
Log.e("DataUploader", "JSONException:" + e.getMessage());
e.printStackTrace();
} catch (IOException e) {
Log.e("DataUploader", "IOException:" + e.getMessage());
e.printStackTrace();
}
return result;
}
public static String postJSONforStringResult(String url, JSONObject json)
throws ClientProtocolException, IOException {
HttpResponse response = postJSON(url, json);
int statusCode = response.getStatusLine().getStatusCode();
String result = (statusCode == 201 || statusCode == 200) ? EntityUtils.toString(response.getEntity()) : "StatusCode=" + statusCode;
return result;
}
나는 왜 입강이 오늘 작동하지 않는지 모르겠다. 죄송합니다.