Volley JsonObjectRequest Post parameters no longer work

You just have to make a JSONObject from your HashMap of parameters: String url = “https://www.youraddress.com/”; Map<String, String> params = new HashMap(); params.put(“first_param”, 1); params.put(“second_param”, 2); JSONObject parameters = new JSONObject(params); JsonObjectRequest jsonRequest = new JsonObjectRequest(Request.Method.POST, url, parameters, new Response.Listener<JSONObject>() { @Override public void onResponse(JSONObject response) { //TODO: handle success } }, new Response.ErrorListener() { … Read more

convert ArrayList to JSONArray

If I read the JSONArray constructors correctly, you can build them from any Collection (arrayList is a subclass of Collection) like so: ArrayList<String> list = new ArrayList<String>(); list.add(“foo”); list.add(“baar”); JSONArray jsArray = new JSONArray(list); References: jsonarray constructor: http://developer.android.com/reference/org/json/JSONArray.html#JSONArray%28java.util.Collection%29 collection: http://developer.android.com/reference/java/util/Collection.html