title: How to clear HttpURLConnection's cache in Android?
body: <p>I have an application which sends a GET request to a link and get some JSON data back from the server, then saves them in a List of Posts (a custom Java object) and show the result in activity...</p>
  <p>The problem is, it shows me the cached result! So if I change something in that JSON file, it takes a while for my application to show those changes!</p>
  <p>I'm using <code>HttpURLConnection</code> for connecting to the server, and I also tried using <code>.setUseCaches</code>:</p>
  <pre><code>URL url = new URL(urlString);
  HttpURLConnection connection = (HttpURLConnection) url.openConnection();
              
  connection.setDefaultUseCaches(false);
  connection.setUseCaches(false);
  ...
  ...
  </code></pre>
  <p>But it didn't work either...</p>
  <p>What should I do?</p>
  <h3>EDIT (I forgot to mention):</h3>
  <p>After I change that value and open the JSON file in PC's browser (any browser), I see the new result, not the cached one... But Android uses the cached version!</p>