title: ArrayList.size Returning 0 but arryList is not empty
body: <p>I'm trying to get the data from a ArrayList through loop but it's showing that list is empty and <code>arrayList.size()</code> is 0 even my <code>adapter.getItemCount()</code> also returning 0 but my arrayList is not empty it has at least 2 or 3 data and it's perfectly placing in RecyclerView but still <code>arrayList.size()</code> is 0</p>
  
  <pre><code>    arrayList = Backgroundtask.getList();
  
      adapter = new RecycleAdapter(arrayList,getContext());
  
      ItemRecyclerView.setHasFixedSize(true);
      layoutManager = new LinearLayoutManager(getActivity());
      ItemRecyclerView.setLayoutManager(layoutManager);
      ItemRecyclerView.setAdapter(adapter);
  
      for(int i = 0; i &lt; arrayList.size(); i++){
  
          int quantity = arrayList.get(i).getQuantity();
  
          Total += quantity ;
      }
      Log.d("ArrayList Size    " , String.valueOf(arrayList.size()));
      Log.d("getItemCount Size " , String.valueOf(adapter.getItemCount()));
  </code></pre>
  
  <p>this is my BackgroundTask:</p>
  
  <pre><code>public ArrayList&lt;DataProvider&gt; getList(){
  
      StringRequest stringRequest = new StringRequest(Request.Method.POST, jsonURL,
  
              new Response.Listener&lt;String&gt;() {
                  @Override
                  public void onResponse(String response) {
  
                      try {
                          JSONArray jsonArray = new JSONArray(response);
  
                          for(int i = 0; i &lt; jsonArray.length(); i++){
                              JSONObject jsonObject = jsonArray.getJSONObject(i);
                              DataProvider dataProvider = new DataProvider(jsonObject.getString("Name"),
                                      jsonObject.getDouble("quantity"));
                              arrayList.add(dataProvider);
                          }
                          UserFragment.adapter.notifyDataSetChanged();
  
                      } catch (JSONException e) {
                          e.printStackTrace();
                      }
  
                  }
              },new Response.ErrorListener(){
          @Override
          public void onErrorResponse(VolleyError volleyError){
  
  
          }
      }) {
          @Override
          protected Map&lt;String, String&gt; getParams() throws AuthFailureError {
  
              Map&lt;String,String&gt; param = new HashMap&lt;String,String&gt;();
              param.put("id",MainActivity.USER_ID.toString());
              return param;
          }
      };
  
      Singletone.getSingletone(context).addToRequest(stringRequest);
      return arrayList;
  }
  </code></pre>