title: HttpURLConnection keeping cache
body: <p>I am currently using this code to get data from server</p>
  
  <pre><code>public static String getResponse(String URL) throws IOException{
  
      try{
          String response_string;
          StringBuilder response  = new StringBuilder();
          URL url = new URL(URL);
          HttpURLConnection httpconn = (HttpURLConnection) url.openConnection();
  
          if (httpconn.getResponseCode() == HttpURLConnection.HTTP_OK){
              BufferedReader input = new BufferedReader(new InputStreamReader(httpconn.getInputStream()));
              String strLine = null;
              while ((strLine = input.readLine()) != null){
                  response.append(strLine);
              }
              input.close();
              response_string = response.toString();
          }
  
          httpconn.disconnect();
  
          return response_string;
      }
      catch(Exception e){
          throw new IOException();
      }
  
  }
  </code></pre>
  
  <p>But it looks like it is keeping cache, maybe not I am not sure, but if I change the data on the server and reopen the activity it's still remains the same on application. I have been using <code>HttpClient</code> before which was working good, but because it is deprecated since <code>API 22</code> I changed it to <code>HttpURLConnection</code>. So is there any way to fix this?</p>