Android Picasso图像加载失败,并显示错误

时间:2019-05-15 17:28:41

标签: android image picasso

我正在尝试使用毕加索从mp3提取图像并将其加载到imageview,但是我无法做到这一点,每次调用毕加索的OnError方法时,我都无法确定问题所在帮助将不胜感激。

 val file = File("/storage/emulated/0/UCDownloads/04 - Bom Diggy Diggy - DownloadMing.SE.mp3")
        Picasso.get()
                .load(file)
                .resize(50, 50)
                .into(holder.covimg,object:Callback{
                    override fun onSuccess() {
                        TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
                    }

                    override fun onError(e:Exception) {
                        e.printStackTrace()
                    }
                })

这是我在logcat中遇到的错误:

W/System.err: java.io.FileNotFoundException: /file:/storage/emulated/0/UCDownloads/04 - Bom Diggy Diggy - DownloadMing.SE.mp3 (No such file or directory)
W/System.err:     at java.io.FileInputStream.open0(Native Method)
        at java.io.FileInputStream.open(FileInputStream.java:200)
        at java.io.FileInputStream.<init>(FileInputStream.java:150)
        at java.io.FileInputStream.<init>(FileInputStream.java:103)
        at android.content.ContentResolver.openInputStream(ContentResolver.java:980)
        at com.squareup.picasso.ContentStreamRequestHandler.getInputStream(ContentStreamRequestHandler.java:47)
        at com.squareup.picasso.FileRequestHandler.load(FileRequestHandler.java:41)
        at com.squareup.picasso.BitmapHunter.hunt(BitmapHunter.java:219)
        at com.squareup.picasso.BitmapHunter.run(BitmapHunter.java:175)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)

0 个答案:

没有答案