How to get the image name of the ImageView in Android? -
i have imageview in android . want name of image set in in imageview. how can ? imageview v = (imageview)findviewbyid(r.id.img); //string name = findimagename(v); if( name.equals(a)) { //do } else{ //do } for first of need set tag imageview <imageview android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/imageview1" android:background="@drawable/bg1" android:tag="bg1"/> now image name set on imageview doing following, imageview v = (imageview)findviewbyid(r.id.img); string backgroundimagename = string.valueof(v.gettag()); and should return image tag name "bg1" . now compare tag names or use further process if( backgroundimagename.equals(bg1)) { //do } else{ //do }