Pentium10 Pentium10 - 1 year ago 171
Android Question

How to clear an ImageView in Android?

I am resusing ImageViews for my displays, but at some point I don't have values to put it.

So how to clear an ImageView in Android?

I've tried:


None of them have cleared the view, it still shows previous image.

Answer Source

I used to do it with the dennis.sheppard solution:


it works but it is not documentated so it isn't realy clear if it effects something else in the view (you can check the ImageView code if you like, i didn't).

I think the best solution is:


I like this solution the most cause there isn't anything tricky in reverting the state and it's also clear what it is doing.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download