-4
Json 키를 JsonObject로 보내려고합니다. 따라서 발리를 사용하여 보내는 방법을 알려주십시오. json = { "product": "magie"}발리에서 게시물 요청시 이러한 유형의 데이터를 보내는 방법은 무엇입니까?
Volley에서 데이터를 보내는 방법에 대해 해당 유형의 데이터와 함께 히트 API에 대해 asyncTask 코드를 아래에 추가했습니다. 그것에 대해
enter code here
protected void onPreExecute() {
if (progress)
GlobalAlerts.showProgressDialog(context);
}
@Override
protected String doInBackground(String... params) {
String resp = null;
JSONObject jsonObject = new JSONObject();
try {
jsonObject.put("product","magie");
} catch (JSONException e) {
e.printStackTrace();
}
String data = "json=" + jsonObject.toString();
String url ="http://anc.php";
resp = new JsonCall().executeHttpPostRequest(url, data);
return resp;
}
protected void onPostExecute(String resp) {
if (progress)
GlobalAlerts.hideProgressDialog();
if (resp != null) {
callback.onTaskComplete(resp);
} else {
GlobalAlerts.singleAlert((Activity) context, context.getString(R.string.warning), "Error", false);
}
}
당신의 코드를 게시 여기에 코드를 입력합니다. – vinoth12594
다음을 확인하십시오 https://www.simplifiedcoding.net/android-volley-post-request-tutorial/ 다른 코드는 여기에 게시하십시오 – Shailesh
다음 링크에서 답변을 찾을 수 있습니다 : - [> http :// /stackoverflow.com/questions/24873718/how-do-i-make-a-volley-jsonobject-request-with-a-custom-object-as-a-parameter][1] –