title: ListView Populates multiple times on button click
body: <p>I have an app that displays data from my server</p>
  
  <p>Now my issue is that I have a Listview that is populated with JSON data from the server
  this  is to display Time Logged, I have a To-Date and a from-date  edit text to enter the needede dates</p>
  
  <p>And everytime I click the button the list view populates but the previous loaded data stays in the listview</p>
  
  <p>What I want to achieve is that everytime the button is clicked the previous data is cleared and only the new data is displayed </p>
  
  <p>I am using volley to GET the Json from the server</p>
  
  <p>I have tried setting a custom Adapter, setting adapter to Null</p>
  
  <p>Here is my On click</p>
  
  <pre><code>Submit.setOnClickListener(new View.OnClickListener() {
          @Override
          public void onClick(View view) {
              Uri.Builder builder2=new Uri.Builder();
              builder2.scheme("https")
                      .authority("www.FAKEWEBSiTE.co.za")
                      .appendPath("DATA.asp")
                      .appendQueryParameter("ClientID", clientId)
                      .appendQueryParameter("Username", email)
                      .appendQueryParameter("Pwd", pwd)
                      .appendQueryParameter("FromDate", FromDate.getText().toString().trim())
                      .appendQueryParameter("ToDate", ToDate.getText().toString().trim());
              URL2=builder2.build().toString();
              LoadReport(URL2);
  </code></pre>
  
  <p>Here is the code where I load the JSON etc.</p>
  
  <pre><code>private void LoadReport(String url) {
          final ProgressDialog pd=new ProgressDialog(reportActivity.this);
          pd.setMessage("Please Wait..Loading Time Log Data");
          pd.setCanceledOnTouchOutside(false);
          pd.show();
          RequestQueue requestQueue=Volley.newRequestQueue(getApplicationContext());
          StringRequest stringRequest=new StringRequest(Request.Method.GET, url, new Response.Listener&lt;String&gt;() {
              @TargetApi(Build.VERSION_CODES.N)
              @Override
              public void onResponse(String response) {
  
  
                  pd.cancel();
                  try {
                      JSONObject jsonObject=new JSONObject(response);
                      if (jsonObject.getInt("success") == 1) {
                          JSONArray jsonArray=jsonObject.getJSONArray("Name");
                          for (int i=0; i &lt; jsonArray.length(); i++) {
                              JSONObject jsonObject1=jsonArray.getJSONObject(i);
                              String key=jsonObject1.keys().next();
                              String task=jsonObject1.getString(key);
                              Project.add(task);
  
  
                          }
                          report.setAdapter(new ArrayAdapter&lt;&gt;(reportActivity.this, android.R.layout.simple_spinner_dropdown_item, Project));
                          report.setClickable(false);
  
  
  
                      }
  
  
                  } catch (JSONException e) {
                      e.printStackTrace();
  
  
                  }
              }
          }, new Response.ErrorListener() {
              @Override
              public void onErrorResponse(VolleyError error) {
                  pd.cancel();
  
                  error.printStackTrace();
              }
          });
          int socketTimeout=30000;
          RetryPolicy policy=new DefaultRetryPolicy(socketTimeout, DefaultRetryPolicy.DEFAULT_MAX_RETRIES, DefaultRetryPolicy.DEFAULT_BACKOFF_MULT);
          stringRequest.setRetryPolicy(policy);
          requestQueue.add(stringRequest);
      }}
  </code></pre>