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,599
  • 2
  • 22
  • 21
Shah Hussain
  • 1
  • 1
  • 3
  • 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
  • 7,501
  • 5
  • 28
  • 50
Charlie-Blake
  • 10,832
  • 13
  • 55
  • 90