/** * Get int resource id, by just passing the string value of android:id from xml file. * Note : This method only works for @android:id or @+android:id right now * * @param fullResIdString the string id of the view * @return the number id of the view */ public static int getAndroidXmlResId(String fullResIdString) { if (fullResIdString != null) { int i = fullResIdString.indexOf("/"); if (i >= 0) { String idString = fullResIdString.substring(i + 1); return getResId(idString, android.R.id.class); } } return View.NO_ID; }