This is how my program works:
1) Display image from server
2) The user changes the image and uploads it to the server
3) Image display by reloading from the server
This is how I get the image from the server:
String src = "http://www.getyourpicture.com/mypicture.jpg"
HttpGet httpRequest = new HttpGet(URI.create(src) );
HttpClient httpclient = new DefaultHttpClient();
HttpResponse response = (HttpResponse)httpclient.execute(httpRequest);
HttpEntity entity = response.getEntity();
BufferedHttpEntity bufHttpEntity = new BufferedHttpEntity(entity);
InputStream instream = bufHttpEntity.getContent();
Bitmap dp = BitmapFactory.decodeStream(instream);
//display dp from here...
The problem is that whenever I “re-upload” the image, it still shows the old image. To confirm that I uploaded the image, I checked the folder containing the image on the server, and even visited the link in the browser. Both approaches show that the image is indeed uploaded. Therefore, I narrowed down to the fact that Android may have an http-caching manager that does not "refresh" the link to the image.
, "", ?
"", ?