Android : Android Picaso - How to not cache images that are not downloaded through it?

on Friday, July 11, 2014


So I am using Picaso to load some images and cache them like so:



ImageView logo = (ImageView)findViewById(R.id.image_logo);
Picasso.with(VenueDetailsActivity.this).load(url).into(logo);


However, I have other images that should not be cached. However, it seems like as soon as Picaso is running in any point in the app, then it starts caching all images no matter if I use Picaso loading on them or not.


How can I not cache certain images using Picasso?


** Does Picasso setups your app that any image loading is cached regardless of using Picasso or not?**


The method I use to download my images are:



private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
ImageView bmImage;

public DownloadImageTask(ImageView bmImage) {
this.bmImage = bmImage;
}

protected Bitmap doInBackground(String... urls) {
String urldisplay = urls[0];
Bitmap mIcon11 = null;
try {
InputStream in = new java.net.URL(urldisplay).openStream();
mIcon11 = BitmapFactory.decodeStream(in);
} catch (Exception e) {
Log.e("Error", e.getMessage());
e.printStackTrace();
}
return mIcon11;
}

protected void onPostExecute(Bitmap result) {
bmImage.setImageBitmap(result);
}
}

0 comments:

Post a Comment