1

In android, if you create an imageview in the xml code like this:

<ImageView
    android:id="@+id/picture_avatar"
    android:layout_width="90dp" 
    android:layout_height="110dp"
    android:background="#bdbdbd" />

How can you tell in the java code, if it has a set image?

There is another button that sets an image using the setImageBitmap function. So I want to tell if it has an image or not.

Thanks

omega
  • 40,311
  • 81
  • 251
  • 474
  • **`There are two more queries similar to this in StackOverflow ... Have a look ... it might help !`** - ***http://stackoverflow.com/questions/9706885/how-can-i-check-if-imageview-is-empty-or-not*** - ***http://stackoverflow.com/questions/9113895/how-to-check-if-an-imageview-is-attcahed-with-image-in-android*** – Devrath Jul 21 '13 at 03:02

1 Answers1

3
pictureavatar.getDrawable() == null

If true, then no image else it has an image

Vrashabh Irde
  • 14,129
  • 6
  • 51
  • 103