0

I'm trying to show and attach image which stored on SD-CARD to image view, I can show image with setImageBitmap without any problem but when I try to use Picasso that don't show image

   final File imageFile = new File(APP.DIR_APP + APP.IMAGE + "/" + channel.get(position).getFileName());
   if (imageFile.isFile() && imageFile.exists()) {
       BitmapFactory.Options options = new BitmapFactory.Options();
       //options.inSampleSize = 8;
       //holder.post_image.setImageBitmap(BitmapFactory.decodeFile(imageFile.getAbsolutePath(), options));
       Picasso.with(context).load(imageFile).into(holder.post_image);
   }
Cœur
  • 37,241
  • 25
  • 195
  • 267
tux-world
  • 2,680
  • 6
  • 24
  • 55

3 Answers3

1

Check if you have added the READ permission if you haven't then add this line in your manifest file

<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Saurabh Padwekar
  • 3,888
  • 1
  • 31
  • 37
0
  1. Log your imageFile path and check it.
  2. Check the context that you are passing to Picasso.with(context)
  3. If everything is ok, chanege your code to:

    if (imageFile.isFile() && imageFile.exists()) {
         Picasso.with(context).load(Uri.fromFile(imageFile)).into(holder.post_image);
    }
    
Seyyed
  • 1,526
  • 3
  • 20
  • 30
0

My code is correct, but when i use wrap_content for width and height of ImageView, i dont see image

tux-world
  • 2,680
  • 6
  • 24
  • 55