Android Picasso Example in Android Studio

Picasso is an image library for Android. It simplifies the process of displaying images from internal storage or from an external URL. When it comes to processing images in an app, Picasso is always my choice.

Loading an image is just simple like this:


//from URL
//from resources, assets, files, content providers
Picasso.with(context).load(new File(…)).into(imageView);


This post will show how to develop an app which load image from website in Android Studio.

  1. Create a new project
  2. Import Picasso library to Android Studio
  3. Load image to an ImageView

Create a new project

I only mention my application name and file here to avoid confusion about name in later parts.

Application Name: PicassoApp
Company Domain: com.test.picassoapp

Since I don’t want to complicate this app, I chose “Empty Activity” as default layout.

Import Picasso library to Android Studio

It is kind of simple to import this library in Android Studio. You just need to add compile ‘com.squareup.picasso:picasso:2.5.2’ line to build.gradle file in your project. There is anjother way which download the JAR file and import it to libs folder.

This is how my project’s build.graddle looks like:

apply plugin: ‘’

android {
compileSdkVersion 23
buildToolsVersion "23.0.2"

defaultConfig {
applicationId ""
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile(‘proguard-android.txt’), ‘’

dependencies {
compile fileTree(dir: ‘libs’, include: [‘*.jar’])
testCompile ‘junit:junit:4.12’
compile ‘’
compile ‘com.squareup.picasso:picasso:2.5.2’


Load image to an ImageView

Firstly, open main activity's layout file (activity_main.xml in my case) and add a new ImageView widget.

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="" xmlns:tools="" android:layout_width="match_parent" android:layout_height="match_parent" android:paddingBottom="@dimen/activity_vertical_margin" android:paddingLeft="@dimen/activity_horizontal_margin" android:paddingRight="@dimen/activity_horizontal_margin" android:paddingTop="@dimen/activity_vertical_margin" tools:context="">

<ImageView android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageView" android:layout_alignParentTop="true" android:layout_centerHorizontal="true" />


The next step is to download an image and load it to mentioned ImageView using Picasso class.

Add following lines to onCreate method of
ImageView imageView = (ImageView) findViewById(;


Remember to add import com.squareup.picasso.Picasso; for Picasso class to work.

Picasso offers more using features such as image resizing, error handling and placeholder. Here is an example:

.resize(100, 100)

Since we are loading image from an URL, it is required to add INTERNET permission. Add <uses-permission android:name="android.permission.INTERNET" /> to project's manifest file.

If you don't want to cache, add networkPolicy and memoryPolicy.

.resize(100, 100)



The library can be downloaded on GitHub.

Leave a Comment

Your email address will not be published. Required fields are marked *

Scroll to Top

By continuing to use the site, you agree to the use of cookies. more information

The cookie settings on this website are set to "allow cookies" to give you the best browsing experience possible. If you continue to use this website without changing your cookie settings or you click "Accept" below then you are consenting to this.