Win a copy of Java Mock Exams (software) this week in the Programmer Certification (OCPJP) forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

compare ImageView and a drawable picture

 
A. Aka
Ranch Hand
Posts: 98
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

How I can test that R.drawable.picture_1 and img1.getId() are equals
because they are pointing on the same picture

actually I am displaying NOT OK


 
Steve Luke
Bartender
Posts: 4181
22
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ImageView#getId() gets the id of the ImageView, not the image displayed in the view. So img.getId() should return R.id.imageView1 not R.drawable.picture_1. So what problem are you actually trying to solve? Because comparing the id of the Drawable and the id of the ImageView is not a useful exercise.
 
Happiness is not a goal ... it's a by-product of a life well lived - Eleanor Roosevelt. Tiny ad:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!