Skip to content Skip to sidebar Skip to footer

Android Avoid Caching

// http client DefaultHttpClient httpClient = new DefaultHttpClient(); HttpEntity httpEntity = null; HttpResponse httpResponse = null; // Checking http request method type if (met

Solution 1:

You can add following HTTP header to your request: Cache-Control: no-cache

httpGet.addHeader("Cache-Control", "no-cache");

Solution 2:

You can add a HTTP header and have :

Cache-Control:no-cache

like

httpPost.addHeader("Cache-Control", "no-cache");
httpGet.addHeader("Cache-Control", "no-cache");

visit http://developer.android.com/reference/android/net/http/HttpResponseCache.html

Post a Comment for "Android Avoid Caching"