evnobev
evnobev

Reputation: 131

Android how to get image resource?

I want to check if an imageview is displaying a certain image, how do I do that? Or maybe just if it has an image at all?

Upvotes: 0

Views: 7469

Answers (2)

Mirco Widmer
Mirco Widmer

Reputation: 2149

I would recommend using the getDrawable()-method:

http://developer.android.com/reference/android/widget/ImageView.html#getDrawable()

Upvotes: 1

Droidman
Droidman

Reputation: 11608

   if(!yourImageView.getDrawable().equals(null)){
    // the View is displaying some image
     } else {
      //no image
     }

Upvotes: 0

Related Questions