I am newbie to Json parsing. I am trying to read a json data using JsonArrayRequest but I am little confused in sending parameters and use POST method.In case o
here is an example to post the request to the server using volly
You can add the parameters to a HashMap and then pass that into the request you are creating;
EDITED:
HashMap mRequestParams = new HashMap();
mRequestParams.put("username","abcd");
mRequestParams.put("password", "123456");
public void vollyStringRequestForPost() {
JsonArrayRequest req = new JsonArrayRequest(Request.Method.POST, strURL, new JSONObject(mRequestParams),
new Response.Listener() {
@Override
public void onResponse(JSONArray response) {
try {
//Here you will receive your response
} catch (JSONException e) {
e.printStackTrace();
}
}
}, new Response.ErrorListener() {
@Override
public void onErrorResponse(VolleyError error) {
//Do what you want to do on error
}
});
mRequestQueue.add(req);
}
}