title: send arraylist as parameter in volley request
body: <p>I'm trying to send arraylist containing numbers as parameter in volley request and then parse it and display the values (in string) in toast. But I'm getting null in response. I would like to know where is the problem. </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false">
  <div class="snippet-code">
  <pre class="snippet-code-css lang-css prettyprint-override"><code>json response:
  
  {
    "got_members": [
      "1",
      "2"
    ]
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>public class SearchFragment extends Fragment{
  
      Button checkme;
      private static final String ADDMEM = "http://www.example.com/api/event/addmembers/", KEY_ADDMEM = "adding_members";
  
      @Nullable
      @Override
      public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
          return inflater.inflate(R.layout.searchfragment, container, false);
      }
  
      @Override
      public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
          super.onViewCreated(view, savedInstanceState);
  
  
          checkme = (Button)view.findViewById(R.id.checkme);
          checkme.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
  
                  checkarraylist();
  
              }
          });
      }
  
      private void checkarraylist(){
          StringRequest stringRequest = new StringRequest(Request.Method.POST, ADDMEM,
                  new Response.Listener&lt;String&gt;() {
                      @Override
                      public void onResponse(String response) {
  
                          if(response != null){
                              try {
                                  JSONObject object = new JSONObject(response);
                              } catch (JSONException e) {
                                  e.printStackTrace();
                              }
  
  
                          }else {
  
                              Toast.makeText(getActivity(), response, Toast.LENGTH_SHORT).show();
                              try {
  
                                  JSONArray itemArray = new JSONObject(response).getJSONArray("got_members");
                                  for (int i = 0; i &lt; itemArray.length(); i++) {
                                      String value = itemArray.getString(i);
                                      Toast.makeText(getActivity(), "Result:" + value + "\n", Toast.LENGTH_SHORT).show();
                                  }
  
  
                              } catch (JSONException e) {
                                  // JSON error
                                  e.printStackTrace();
                                  Toast.makeText(getActivity(), "Json error: " + e.getMessage(), Toast.LENGTH_LONG).show();
                              }
  
                          }
                      }
                  }, new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
                  Toast.makeText(getActivity(), error.toString(), Toast.LENGTH_LONG).show();
              }
          }) {
              @Override
              protected Map&lt;String, String&gt; getParams() {
                  ArrayList&lt;String&gt; strings = new ArrayList&lt;String&gt;();
                  strings.add("10");
                  strings.add("20");
                  strings.add("30");
                  Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
                  int i=0;
                  for(String object: strings){
                      params.put("adding_members["+(i++)+"]", object);
                      System.out.println(object);
                  }
  
             /*    String array[]=strings.toArray(new String[strings.size()]);
  
                  for(String k: array)
                  {
  
                      params.put("adding_members", k);
                      System.out.println(k);
                  } */
  
  
  
                  return params;
              }
  
              @Override
              public Map&lt;String, String&gt; getHeaders() throws AuthFailureError {
                  Map&lt;String, String&gt; params = new HashMap&lt;String, String&gt;();
                  params.put("Content-Type", "application/x-www-form-urlencoded;  charset=utf-8");
                  return params;
              }
  
          };
  
          RequestQueue requestQueue = Volley.newRequestQueue(getActivity());
          requestQueue.add(stringRequest);
      }
  
  
  
  
  }</code></pre>
  </div>
  </div>
  </p>