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 Exit android app on back pressed?
What happens next when the device switches between portrait and landscape?
What is Intent? What is the difference between an implicit intent and an explicit intent?
How to avoid multiple button click at same time in android?
Key Points to remember while develop the Android Application.
How do i load image from drawable folder in Jetpack Compose?
How to Use Deprecated Handler() in Android - RRutors Guide
Check List for Generate Signed APK Android
Fix Android Emulator Kill Error When Running Your App
How to validate email address in Android with Kotlin?
Extract Date and Time from Long Type Variable - RRutors
Fix Duplicate Files in APK Build.gradle Issue - RRutors
How to check Android version?
ERR_ACCESS_DENIED in Android Webview with sdk 30
What is Context?
How to convert milli seconds to hours, minutes and seconds in Android?
How to find Android Device UDID or unique ID?
How do I check in SQLite whether a table exists?
How to get complete address from latitude and longitude?
How To Set Text Color Programmatically Android TextView?
What is NetworkOnMainThread Exception?
Emulator: emulator: ERROR: Can't find 'Linux version ' string in kernel image file: Andr
What are the notifications available in android?
What is ANR in android?
How to get a contact image using a phone number in android?
What is Application?
How to stop EditText focus at Activity startup in Android?
Android Studio project R can't find
What is ANR? How to avoid and resolve it?
Permission denied for window type 2010 in Marshmallow device
Fix Play Store Rejection Due to SMS Permission - RRutors
How to copy database from assets folder in android using kotlin
How to install/ uninstall apk by command line ADB
Fix Behavior Subclass BottomSheetBehavior Exception - RRutors
Open PDF in Google Drive with Intent in Android - RRutors
Symmetric vs Asymmetric Encryption in Android Server - RRutors
How to save activity State in Android?
Add Jar/Library Files as Dependency in Android Studio
How to convert DP to Pixel and Pixel to Dp?
How to Get bitmap from drawable: Android