When you create a layout, you define an id for your views like this:
<ImageView
android:id="@+id/myImage"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/main01" />
and in your code you have:
ImageView img = (ImageView) findViewById(R.id.myImage);
now you have the object of img.
How can I get the id of img (“myImage”) as a string? I need something like this:
String strId = getStringId(img);
// now strId is "myImage"
Try this.
Output : ============ Id :: myImage