How to get raw resource file name by id?

It should work with resources.getResourceName( );


Use Resources.getResourceName(id) to get package:type/entryname, or Resources.getResourceEntryName(id) to get entry name (file name.)


If you're looking for the name from a resource ID, you can use Resources.getResourceName(). You can get the Resources object using Context.getResources().

Personally, I'd rather store an array of strings in your strings.xml and map that to the resource IDs, but it depends on what you're really trying to accomplish.

Tags:

Java

Android