Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to load image from SD card using Picasso library

i need to load images from the Sd card into gridview. For efficiency i'm using Picasso Library

Picasso.with(activity).load(images.get(position).getDataPath())
            .resize(96, 96).centerCrop().into(viewHolder.image);

I used the following code in the adapter. unfortunately m unable to see any images so please can any one help.

Note And also can anyone suggest any efficient image loading library to load the images from the sd card.

Requirement I dont to load the image every time when scrolling. If it is already loaded dont load the image on scrolling

like image 561
user3607798 Avatar asked Jun 07 '14 13:06

user3607798


1 Answers

To load the file you need to convert it to a uri first

Uri uri = Uri.fromFile(new File(images.get(position).getDataPath()));

Picasso.with(activity).load(uri)
            .resize(96, 96).centerCrop().into(viewHolder.image);

Requirement I dont to load the image every time when scrolling. If it is already loaded dont load the image on scrolling

  • Picasso is excellent for this
like image 157
Lena Bru Avatar answered Sep 21 '22 18:09

Lena Bru