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

后端 未结 7 1545
半阙折子戏
半阙折子戏 2020-12-13 05:43

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

7条回答
  •  暖寄归人
    2020-12-13 06:32

    You can do imageViewOne.getDrawable() for the image you set on the src attribute - meaning setImageResource/Bitmap. Or imageViewOne.getBackground() for the background attribute - meaning setBackground.

提交回复
热议问题