title: Refresh data in an Activity on OnClick method?
body: <p>Want to load currently updated data from sever , Using valley api(json response).</p>
  
  <p>onCreate is loading only data for the first time only.after that no new data is adding to the list.</p>
  
  <p>Loading data, on listview(Contains image,text).</p>
  
  <pre><code> protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_downloadimg);
          buttonrefresh = (Button) findViewById(R.id.btnrefresh);
  
          listView = (ListView) findViewById(R.id.listViewdoenload);
  
          listItems = new ArrayList&lt;InfoData&gt;();
  
          listAdapter = new CustomAdapter(this, listItems);
          listView.setAdapter(listAdapter);
  
  
          Cache cache = VolleySingleton.getInstance().getRequestQueue().getCache();
          Cache.Entry entry = cache.get(URL_FEED);
          if (entry != null) {
              // fetch the data from cache
              try {
                  String data = new String(entry.data, "UTF-8");
                  try {
                      parseJsonFeed(new JSONObject(data));
                  } catch (JSONException e) {
                      e.printStackTrace();
                  }
              } catch (UnsupportedEncodingException e) {
                  e.printStackTrace();
              }
  
          } else {
              // making fresh volley request and getting json
              JsonObjectRequest jsonReq = new JsonObjectRequest(Request.Method.GET,
                      URL_FEED, null, new Response.Listener&lt;JSONObject&gt;() {
  
                  @Override
                  public void onResponse(JSONObject response) {
                      VolleyLog.d(TAG, "Response: " + response.toString());
                      Log.d("Response: ", response.toString());
                      if (response != null) {
                          parseJsonFeed(response);
                      }
                  }
              }, new Response.ErrorListener() {
  
                  @Override
                  public void onErrorResponse(VolleyError error) {
                      VolleyLog.d(TAG, "Error: " + error.getMessage());
                  }
              });
  
              // Adding request to volley request queue
              VolleySingleton.getInstance().addToRequestQueue(jsonReq);
          }
  
          buttonhome.setOnClickListener(new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                  refresh();
              }
          });
  
      }
  </code></pre>