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 avoid multiple button click at same time in android?
How to Use Deprecated Handler() in Android - RRutors Guide
What is ANR? How to avoid and resolve it?
Fix Play Store Rejection Due to SMS Permission - RRutors
How to install/ uninstall apk by command line ADB
What is Android Fragments?
Key Points to remember while develop the Android Application.
FCM Not Receiving Notifications in Android - RRutors
How to Generate signed apk with android studio
What is "shared preferences" in Android ?
How To Set Text Color Programmatically Android TextView?
How to start a new activity on button click
What happens next when the device switches between portrait and landscape?
What is NetworkOnMainThread Exception?
What are the notifications available in android?
How to get an image resource by it's name in android?
What is the difference between match_parent and fill_parent?
Invoke-customs are only supported starting with android 0 --min-api 26
Android Studio project R can't find
Emulator: emulator: ERROR: Can't find 'Linux version ' string in kernel image file: Andr
What is Context?
How to convert DP to Pixel and Pixel to Dp?
Set Activity to Fullscreen Mode in Android - RRutors
Fix Android Emulator Kill Error When Running Your App
How to save activity State in Android?
What is Android?
ERR_ACCESS_DENIED in Android Webview with sdk 30
How to get a contact image using a phone number in android?
What is Intent? What is the difference between an implicit intent and an explicit intent?
How do I generate random numbers in Dart?
What is Application?
Open PDF in Google Drive with Intent in Android - RRutors
Permission denied for window type 2010 in Marshmallow device
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
How to validate email address in Android with Kotlin?
Hide/Disable soft keyboard on Activity launch: Android
How to convert milli seconds to hours, minutes and seconds in Android?
Check List for Generate Signed APK Android
How to copy database from assets folder in android using kotlin
Explain Fragment Life Cycle