With Resources.getIdentifier() method we can get the resource id by its name. If we know drawable name then we can get drawable id by If we know color name then we can get color id by
int resId = getResources().getIdentifier("Name of Resource", "drawable", mApplicationContext.getPackageName());
int resId = getResources().getIdentifier("Name of Resource", "color", mApplicationContext.getPackageName());
How to reduce APK package size?
Fix Android Emulator Kill Error When Running Your App
How to install/ uninstall apk by command line ADB
How to avoid multiple button click at same time in android?
What is NetworkOnMainThread Exception?
Extract Date and Time from Long Type Variable - RRutors
FCM Not Receiving Notifications in Android - RRutors
Symmetric vs Asymmetric Encryption in Android Server - RRutors
Android Studio project R can't find
Emulator: emulator: ERROR: Can't find 'Linux version ' string in kernel image file: Andr
Hide/Disable soft keyboard on Activity launch: Android
How to get screen size (width,height) in Android?
What happens next when the device switches between portrait and landscape?
What are Android Versions available?
How to convert DP to Pixel and Pixel to Dp?
What is Intent? What is the difference between an implicit intent and an explicit intent?
What is Application?
Key Points to remember while develop the Android Application.
What is Context?
Fix Duplicate Files in APK Build.gradle Issue - RRutors
Fix Behavior Subclass BottomSheetBehavior Exception - RRutors
Permission denied for window type 2010 in Marshmallow device
Check List for Generate Signed APK Android
How to stop EditText focus at Activity startup in Android?
Explain Fragment Life Cycle
Open PDF in Google Drive with Intent in Android - RRutors
Add Jar/Library Files as Dependency in Android Studio
What is Android Fragments?
Decompile APK Files: How to Get Source Code - RRutors Guide
How do I check in SQLite whether a table exists?
How to check Android version?
How to get an image resource by it's name in android?
INSTALL_FAILED_INVALID_APK: Split lib_slice_9_apk was defined multiple times. It is possible that th
How to copy database from assets folder in android using kotlin
What are the notifications available in android?
How to find Android Device UDID or unique ID?
How do i load image from drawable folder in Jetpack Compose?
How to Use Deprecated Handler() in Android - RRutors Guide
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
Invoke-customs are only supported starting with android 0 --min-api 26