Android Studio Load Image from URL

In this Android Studio article we are going to learn Load Image from URL in Android, so for

this purpose we need to use a third party library. the library that we are using is Picasso library 

it is a powerful image downloading and catching library for android.

 

 

 

Also you can read more android development articles

1: Android Development Articles

 

 

Learn How to Create Custom Spinner in Android Studio .

 

 

 

 

So first of all you need to open your Android Studio and create a New Project, after that choose

your API Level for this article iam using API Level 22. 

 

 

 

After creating of the project in Android Studio you need to open build.gradle(Module:app) and

in the dependencies section you need to add the library like this. after adding the library you 

need to sync your Android project.

 

 

 

 

Now you need to open your main_activity.xml and add an ImageView widget, also we are

using RelativeLayout for this article. so this is our main_activity.xml file.

 

 

 

 

 

 

So now open your MainActivity.java file. you can see that in the first we have created the object

of our ImageView, also we need to create String url variable, because we want to store our url in

that variable.

 

 

 

 

 

 

In the above code this method is for Load Image from URL in Android Studio. you can simply use

Picasso library for loading the image and after that setting the image in our ImageView.

 

 

 

 

 

because we are loading image from url and it needs internet connection, so before runing

your Android Project, open your AndroidManifes.xml file and add the internet permission.

if you don’t do this, you will not see the image.

 

 

 

 

 

 

Run the complete project this will be the result.

Android Studio Load Image from URL
Android Studio Load Image from URL

Subscribe and Get Free Video Courses & Articles in your Email

 

1 thought on “Android Studio Load Image from URL”

Comments are closed.

Codeloop
Share via
Copy link
Powered by Social Snap
×