在我的Android應用程序中,用戶可以上傳他們的個人資料圖片。它成功地在服務器上上傳了新的圖像,但它仍然在應用程序中顯示舊圖像。當然,我在應用程序中通過HTTP重新加載圖像,但它仍然顯示舊圖像。Android在上傳新的個人資料圖片後繼續顯示舊圖片
當我關閉應用程序並重新開始後,它會在Android應用程序中顯示上傳的圖像。所以,我認爲它應該是一個緩存問題,如網站。上傳圖片後,我嘗試刪除緩存,但仍然無法使用。
我已經全面搜索解決這個問題,但是我找不到解決方案。
新圖像保存在Android內存中嗎?任何人有想法?謝謝。
這裏是代碼。
public static void download(String url, ImageView imageView)
{
Bitmap cachedImage = mImageCache.get(url);
if(cachedImage != null)
{
imageView.setImageBitmap(cachedImage);
}
else if(cancelPotentialDownload(url, imageView))
{
mImageCache.clear();
ImageDownloaderTask task = new ImageDownloaderTask(url, imageView);
DownloadedDrawable downloadedDrawable = new DownloadedDrawable(task);
imageView.setImageDrawable(downloadedDrawable);
task.execute(url);
}
}
吃了你重新設置圖像到哪裏它顯示? – Pietu1998
調用onresume中的重新設置圖像方法() –