Not clearing on setImageURI(null)
andre-vm opened this issue · 2 comments
andre-vm commented
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
if "pictureFile" is null,"pictureFile?.absolutePath" will not run in Kotlin.
so, the code not executed.
andre-vm commented
@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.