Search code examples
androidandroid-imageviewpicassookhttp

Picasso 2.5.2 does not load a local image


I am using Picasso 2.5.2 to use it with OkHttp 2.5.0 The code in onCreate() is like below:

 File mypath = new File(getFilesDir().getAbsolutePath()+"/"+ date + "image.png");
        if (mypath.exists())
        {
            Picasso.with(FullscreenImage.this).load(mypath).into(fullImage);
            Toasty.info(FullscreenImage.this, mypath.toString()).show();
        }
        else
        {
             // Download the image from Firebase and create the image in the 
             //  same directory and name
        }

I see the image in the files folder in my app folder but it does not display in the image view. The image size: 1.4 MB


Solution

  • I have resolved my issue by turning the file into a bitmap then use it in the ImageView:

    Bitmap bitmap = BitmapFactory.decodeFile(mypath.toString());
                fullImage.setImageBitmap(bitmap);