Java tutorial
//package com.java2s; import android.content.res.Resources; import android.view.View; public class Main { public static String getResourceId(View v) { // http://stackoverflow.com/a/17583380/198348 int id = v.getId(); String idString = "no id"; if (id != View.NO_ID) { Resources res = v.getResources(); if (res != null) idString = res.getResourceEntryName(id); } return idString; } }