I want to check which image resource is attached to ImageView in xml, I am able to check that which image resource is attached to image view but my requirement
I already answered on the similar topic here: Get the ID of a drawable in ImageView.
The approach is based on tagging a view with a specified resource id in the custom LayoutInflater. Whole process is automated by a simple library TagView.
As a result, you can compare two drawables just by their ids:
TagViewUtils.getTag(regProfile, ViewTag.IMAGEVIEW_SRC.id) == R.drawable.ivpic