Design a site like this with WordPress.com
Get started

Picasso Library in Android

Picasso is a widely used library in Android Studio. It helps to load images of various formats. Images can be edited, resized and cropped using Picasso. It is named after the famous Spanish painter Pablo Picasso.

Steps to use Picasso:

1. In build.gradle, add implementation ‘com.squareup.picasso:picasso:2.5.2’

2. In Manifest file, add <users-permission android:name=”android.permission. INTERNET”/>

3. In layout file, add an <ImageView />

4. In Activity Java file, import the library by adding “import com.squareup.picasso.Picasso;” statement

5. Loading the image inside the Activity Java file:
  ImageView imageView = findViewById(R.id.imageView);
Picasso.with(this)
.load(“url/img”)
.into(imageView);

 6. To resize, simply add this to the Picasso instance:
.resize(size, size);

7. To add a placeholder, simply add this to the Picasso instance:
.placeholder(R.mipmap.ic_launcher);

8. To crop and make it fit, add this to the Picasso instance:
.centerCrop()
.fit();

Any further information can be found at https://github.com/square/picasso .

Advertisement

Published by Farial Mahmod Tishan

Life-long learner. Developing Flutter apps on Parrot Linux OS .

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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

%d bloggers like this: