getResourceName(...) you can use getResourceName(...) .
String fullName = getResources().getResourceName(view.getId());
But there is some problem. This method will give you the full browsing path, for example: "com.google:id/ivPerson"
In any case, you can use this trick to get only the name of the view:
String fullName = getResources().getResourceName(view.getId()); String name = fullName.substring(fullName.lastIndexOf("/") + 1);
Now the name will be exactly "ivPerson"
source share