How to Load image From URL :

How to Load image From URL :

Hello Friends !! welcome back to https://yashajabiya.wordpress.com/ .

Today we learn about how to load image direct from URL :

Using Picasso Image Loader library , we can load our image direct url to our ImageView control. Which you can Download from here :

So download .jar file and put into your libs folder . load with your build.gradle file on dependencies part :

compile files('libs/picasso-2.5.2.jar')

now take one ImageView Control your xml file :


Cast into your .java file :

ImageView img = (ImageView) findViewById(R.id.img);

Load url image in your ImageView control using Picasso:

Picasso.with(contex)
        .load("https://yashajabiya.files.wordpress.com/2016/07/facebook_cover.jpg?")
        .placeholder(R.drawable.default_img)
        .error(R.drawable.error_img)
        .into(img);

Parameter & Description :

load : Pass url which you want to load image.

placeholder:  It will show image as a place holder untill your url image not loaded fully on control.

error: It will show when loading process over and any problem occure with url then it show error drawable image.

Thank you : 

If any query feel free to write here :

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s