vinc3m1 / RoundedImageView

A fast ImageView that supports rounded corners, ovals, and circles.
Other
6.44k stars 1.25k forks source link

Not clearing on setImageURI(null) #239

Closed andre-vm closed 1 year ago

andre-vm commented 5 years ago

Hi! Thank you for such a nice library! I just replaced an ImageView with a RoundedImageView (2.3.0), and I have this call inside my fragment:

imageViewPicture.setImageURI(pictureFile?.toUri())

When pictureFile is null, the previous image remains visible, unexpectedly. In order to solve the problem, I changed the code to this:

val drawable = Drawable.createFromPath(pictureFile?.absolutePath)
imageViewPicture.setImageDrawable(drawable)
XingSpace commented 5 years ago

if "pictureFile" is null,"pictureFile?.absolutePath" will not run in Kotlin. so, the code not executed.

andre-vm commented 5 years ago

@XingSpace The second snippet works fine. The problem here is about the behavior of imageViewPicture.setImageURI(pictureFile?.toUri()). When pictureFile is null, that call is equivalent to imageViewPicture.setImageURI(null), which should clear the image view, but it doesn't.