I recently ran into an issue using Picasso with Android's linearlayout. I was using Picasso to load images from a url into a linearlayout, handling errors with Picasso's build object as follows:
Picasso.Builder builder = new Picasso.Builder(this.mContext);
builder.listener(new Picasso.Listener()
{
@Override
public void onImageLoadFailed(Picasso picasso, Uri uri, Exception exception)
{
picasso.load(mThumbIds[0]).into(imageView); // on failure just load the default image
}
});
Picasso picasso= builder.build();
I was recycling the images correctly with convertView (using a viewholder class), but I couldn't track down the source of a memory leak which occured every time a new image was loaded - eventually causing the app to crash. The leak however when away when I stopped using Picasso's builder, instead just using a simple try catch setup.
try{
Picasso.with(mContext).load(logo_url).placeholder(R.drawable.alchemy).into(holder.imageView);
}
catch (Throwable e){
Picasso.with(mContext).load(R.drawable.alchemy).into(holder.imageView);
}
Thank you for sharing the article. The data that you provided in the blog is informative and effective.
ReplyDeleteTableau Training in Hyderabad
There will be best course in Hyderabad, duck creek policy program,duck creek can earn a salary 130000 per annum.it is useful to students career in the field you have interest visit my website link.thanks youhttps://duckcreektraining.com/
ReplyDeleteNice thanks for sharing informative post like this keep posting if like more details visit my website linkhttps://snowflakemasters.in/
ReplyDelete