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.
You can use imageButton. getDrawable() to get the drawable of the ImageButton object and then use setImageDrawable() instead of setImageResource() .
You can add ImageView and VideoView in RelativeLayout and set ImageView to invisible and VideoView to visible and vice-versa and you can play video on onClick.
imageViewOne.getVisibility() == 0
use this instead:
imageViewOne.getDrawable() == null
From documentation:
/**
* Gets the current Drawable, or null if no Drawable has been
* assigned.
*
* @return the view's drawable, or null if no drawable has been
* assigned.
*
*/
public Drawable getDrawable() {}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With