Android: Picasso load image failed . how to show error message

后端 未结 6 587
后悔当初
后悔当初 2020-11-29 02:37

I am trying to use the picasso library to loading the image store in the mediastore. When I called load(imageview, callback), the picasso call onFail instead of onSuccess. H

6条回答
  •  臣服心动
    2020-11-29 03:14

    In case you want to use Picasso with Kotlin and lambda expression it could be as short as this:

    val picasso = Picasso.Builder(context)
                .listener { _, _, e -> e.printStackTrace() }
                .build()
    

    ...and then you can load image as usual:

    picasso.load(url).into(imageView)
    

提交回复
热议问题