【问题标题】:Picasso 2.5.2 does not load a local imagePicasso 2.5.2 不加载本地图像
【发布时间】:2018-08-26 20:14:38
【问题描述】:

我正在使用 Picasso 2.5.2 与 OkHttp 2.5.0 一起使用 onCreate() 中的代码如下:

 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
        }

我在我的 app 文件夹的 files 文件夹中看到了图像,但它没有显示在图像视图中。 图片大小:1.4 MB

【问题讨论】:

    标签: android android-imageview picasso okhttp okhttp3


    【解决方案1】:

    我已通过将文件转换为位图然后在 ImageView 中使用它来解决我的问题:

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

    【讨论】:

      猜你喜欢
      • 2016-03-27
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2020-03-16
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-09-15
      相关资源
      最近更新 更多