0

In my app, I have listview with imageview. I'm Using picasso for download image from URL. Its working perfectly. But my issue is, Its take some time to download.So, I want to show Image from drawable folder until image download.Once downloading finished then set URL image in imageview How to do in android using picasso.

Please anyone guide me!

Thanks in advance!!

Nikhil PV
  • 1,014
  • 2
  • 16
  • 29
hikoo
  • 517
  • 4
  • 10
  • 20

4 Answers4

4

Picasso has a built in function for displaying placeholder images. Use it like this:

Picasso.with(context)
   .load(imageUrl)
   .placeholder(R.drawable.image_name);
M.Waqas Pervez
  • 2,492
  • 2
  • 19
  • 33
0

Use this code :

Picasso.with(context)
   .load(url)
   .placeholder(R.drawable.placeholder).into(imageView);



 In above code:
     url is the url of image that you want to load into imageview. 
     R.drawable.placeholder is the placeholder image that is placed in your project drawable folder.
     imageview is the object of imageview into which you want to load image.
Dhiraj Choudhary
  • 195
  • 5
  • 16
0

You just put your static drawable image for your imageView in your xml file,as:

android:background="@drawable/image"`

It will help u.

Andolasoft Inc
  • 1,296
  • 1
  • 7
  • 16
0

Picasso supports both download and error placeholders as optional features.

Picasso.with(context)
.load(url)
.placeholder(R.drawable.user_placeholder)
.error(R.drawable.user_placeholder_error)
.into(imageView);

A request will be retried three times before the error placeholder is shown.

More Info http://square.github.io/picasso/

This may helps you.

Sathish Kumar J
  • 4,280
  • 1
  • 20
  • 48