I have set an image to an ImageView control in android:
ImageView
iv.setImageResource(R.drawable.image1);
I want to get this associated Drawab
if ((holder.fav.getDrawable().getConstantState()) == context.getResources().getDrawable(R.drawable.star_blank).getConstantState() ) { holder.fav.setImageDrawable(context.getResources().getDrawable(R.drawable.star_fill)); // comparison is true }
//getConstantState() is the key