0

How to compare imageview tag with other imageview backgroundresource in android

if (imageview1.getTag() == imageview2.getbackground()) {
    // do something
}

Can we do it like this?

Nesar
  • 5,252
  • 2
  • 18
  • 17
  • https://stackoverflow.com/questions/4526585/get-the-id-of-a-drawable-in-imageview – ADM Apr 25 '18 at 09:34

1 Answers1

0

This is definitely feasible. I mean, you can use a drawable as a tag in an imageView. Since == just checks if they are the same instance, this comparison should work.

However, it is terribly inefficient to use a Drawable as a tag.

Also, what is your problem? What are you trying to do? What is not working the way you want it to work?

I feel like your question needs to tell us more before it can be answered.

Faysal Ahmed
  • 6,464
  • 5
  • 23
  • 43
Charlie-Blake
  • 10,292
  • 13
  • 52
  • 89