Drop the extension:
String filename = "abc";
int id = getResources().getIdentifier(filename, "raw", getPackageName());
More Related Contents:
- Get resources images from variable
- Is there a way to get the source code from an APK file?
- Android getResources().getDrawable() deprecated API 22
- getColor(int id) deprecated on Android 6.0 Marshmallow (API 23)
- How do I get the resource id of an image if I know its name? [duplicate]
- How can I assign an ID to a view programmatically?
- Is it possible to have placeholders in strings.xml for runtime values?
- Storing R.drawable IDs in XML array
- Remove all unused resources from an android project
- how to get string from different locales in Android?
- About Android image and asset sizes
- Android XML Percent Symbol
- How does the mapping between android resources and resources ID work?
- How to fix: android.app.RemoteServiceException: Bad notification posted from package *: Couldn’t create icon: StatusBarIcon
- Load dimension value from res/values/dimension.xml from source code
- Android Resources$NotFoundException: Resource ID #0x7f030027
- format statement in a string resource file
- Android: integer from xml resource
- Android Studio 3.1 Cannot Resolve Symbol (Themes, Widget, attr, etc.)
- Android Raw folders – creation and reference
- Get color value programmatically when it’s a reference (theme)
- Android Studio cannot resolve R in imported project?
- Android: What is android.R.id.content used for?
- How can I get color-int from color resource?
- Android Studio: Creating landscape layouts
- String Resource new line /n not possible?
- What is the concept behind R.java?
- Using Locale to force Android to use a specific strings.xml file for a non-supported language
- Getting resources of another Application
- ERROR No package identifier when getting value for resource number