Mukunda Mukunda - 1 year ago 112
Android Question

how to check if an ImageView is attached with image in android

I am setting an image to ImageView in android code not in xml, but could not make out how to check whether that image has been set in or not in java.

Tried with

imageViewOne.getVisibility() == 0

but it is not working

If image has been set to ImageView then I am attaching that image for sending mail.

Answer Source

imageViewOne.getVisibility() == 0

use this instead:

imageViewOne.getDrawable() == null
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download