Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Picasso image loading previously cached images

I am using picasso library in my project to fetch url images from the server into my ImageView, but unfortunately picasso loading the previously cached images from disc instead of loading the new images from url. Please find the below piece of code for your reference.

Picasso.with (ImageActivity.this)
                    .load(url)
                    .placeholder (R.drawable.default_user)
                    .error (R.drawable.default_user)
                    .into(imgUser);

I have also tried the solutions like:

Picasso.with(ImageActivity.this).invalidate(url);

and

Picasso.with (ImageActivity.this)
                            .load(url).memoryPolicy(MemoryPolicy.NO_CACHE)
                            .placeholder (R.drawable.default_user)
                            .error (R.drawable.default_user)
                            .into(imgUser);

But nothing is working for me. Kindly help me to resolve my issues.

Thanks in advance.

like image 963
Chandru Avatar asked Dec 01 '22 17:12

Chandru


1 Answers

Try :

  Picasso.with(mContext)
        .load(URL)
        .memoryPolicy(MemoryPolicy.NO_CACHE )
        .networkPolicy(NetworkPolicy.NO_CACHE)
        .error(R.drawable.xxx)
        .into(xx);
like image 150
Nikhil Verma Avatar answered Dec 04 '22 14:12

Nikhil Verma