Picasso Android Tutorial – Android Picasso Image Loader Library

Hello friends, today we will be learning about how we can use picasso android library developed by sqaure. Picasso one of the most popular library for android. It is very simple and powerful library for image downloading and caching.

There are also some alternative libraries like Volley. I already a published a tutorial about Using Android Volley Library to Load Image From Internet. In this post we will learn about picasso android library.

Why Picasso Android or Any other Android Library?

You might be thinking that why we should use a 3rd party library. You can achieve your task without using a 3rd party API as well. I have also posted a tutorial about downloading image without using 3rd party library. But if you will use the core method then it would take larger amount of code. But if we will use a 3rd party library like picasso then we will achieve our goal in few lines of code.  So if we will not use a 3rd party library then  we would need

  1. Very large amount of code to be written
  2. We have to write another logic to implement caching. Caching is very important to make the application faster.
  3. We also have to deal with memory while writing the code.

BUT if we will use picasso then all the above mentioned things would be taken care of by picasso.

Adding Picasso Library to our Android Project

Adding picasso android library to your project is very easy. You just need to add the following line in the dependency block of your build.gradle file. I am assuming that you are using Android Studio.

After adding it just sync your project.

Loading Image from URL by Using Picasso Android Library

Loading image from URL by using Picasso Android Library is very simple and easy. The first thing we would need is an ImageView. Unlike Volley’s NetworkImageView with Picasso we can use normal ImageView.

Code for Loading Image with Picasso

It is very simple. We have to use the Picasso class.

Placeholder and Error Handling

Because we are loading the image from internet; the process would take some time depending on the internet speed. So it would be a good idea to display a image from the device while the image from URL is getting loaded.

One more situation could be when the image is not downloaded from the URL (when the URL given is wrong). In this case we should display an error image. Both these things can be done very easily by using picasso. See the following code snippet.

Re-sizing and Rotating

We can also resize and rotate the image very easily.

Trying Picasso Android Library in Our Project

Now lets try the above codes in our Android Studio Project. So I will be creating a new Android Project.

  • Open Android Studio and create a new project. I have created PicassoDemo.
  • First we have to add the Picasso Library. So open your build.gradle and add the following line inside dependency block and sync your project.

  • As we will load the image from a URL so we will also need internet permission. So open AndroidManifest.xml and add internet permission.

  • We will create an ImageView now. So come inside activity_main.xml and write the following xml code.

  • Now come inside MainActivity.java and define your ImageView.

  • We need two images one for placeholder and one for error. I will be using the following images. Just save these and paste inside the drawable folder of your project.
  • Now we need a URL to an ImageFile. I have this URL


  • We will load the image from the above URL. Write the following code inside onCreate().

  • So the final code for our MainActivity.java would be.

  • Finally run your application.
picass android
Picasso Android
  • Bingo! Its working absolutely fine.

So thats all for this Picasso Android Tutorial friends. Feel free to ask if having any query regarding this Picasso Android tutorial. Thank You 🙂

33 thoughts on “Picasso Android Tutorial – Android Picasso Image Loader Library”

  1. Thank you that’s really helpful .
    I’d like to ask you if I can use Picasso to upload picture from the gallery to my server?
    Thank you.

  2. Hi Bilal,
    This is nasir ali, the work you are doing is so good i love that.
    May i know, Can i download a bundle of images and display in list and how.

  3. How can i set Image in My Custom ImageView using Picasso is it possible ?

    Right now i am using https://github.com/Pkmmte/CircularImageView as a ImageView and load image in that like that


    Target target = new Target() {
    public void onBitmapLoaded(Bitmap bitmap, Picasso.LoadedFrom from) {

    public void onBitmapFailed(Drawable errorDrawable) {

    public void onPrepareLoad(Drawable placeHolderDrawable) {

    why i am not able to set image in that CustomImageView

    please help me.

  4. I am getting error loading some images from Internet i have large images.

    let take i have 6 image in that 4 loaded correctly 2 not loaded from server

    how to resolve this problem

  5. Hi, khan bhai nice tutorial thank you very much.
    Can we use Picasso with offline image cache management,if you have any suggestion or links please help me

  6. when i try to set image i got error image how i know which error is thare i print url and it’s proper if i copy url and past into browser image show but in application image not show error image come up

  7. Hello, I got everything working thanks to you ! Much appreciated . However, when I tried retrieving images from my database of a bigger size. I am unable to show the images in gridview. Nothing is wrong with my codes when I used a resized and compressed image (Edited using Photoshop). Is there a way to retrieve my original (Without compression) Images ?

  8. Dear Belal I teach Android and I have found your tutorials most useful. My students are able pto use many features of Android thanks to your simple tutorials.

  9. how can i download image from mysql server using picasso???
    plz help…. i searched a lot about this… and no one have this answer..

  10. how can I do ” I need to drag an image and drop on another then if both matches then it should accept otherwise it shouldn’t.” how can i match that image with other ? I am using picasso for (Url’s for those images). I need to write for matching of those two Urls ……..

  11. when i am using picasso class like this

    .load(“YOUR IMAGE URL HERE”)

    The word “with ” get unresolved reference
    how to remove this error


Leave a Comment