I have an ImageView that is set to cam.jpg in my XML Layout code:
<ImageView
android:id="@+id/imvCover"
android:layout_width="130dp"
android:layout_height="180dp"
android:layout_marginLeft="10dp"
android:layout_marginTop="15dp"
android:layout_marginRight="15dp"
android:scaleType="fitCenter"
android:src="@drawable/cam"
/>
Is there a way, in my Java code, to find out if my imvCover is currently displaying @drawable/cam or something else? Something like this:
if (imvCover.displayedImageResource == R.id.cam)
// do something
else
// do something else
Thanks.
try to use
setTag()andgetTag()methods like this :when setting the drawable resource to your
imageViewdo like this :and to find out which drawable is setted to your
imageview, just get the tag ans test it :