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 Generate signed apk with android studio
What happens next when the device switches between portrait and landscape?
Open PDF in Google Drive with Intent in Android - RRutors
ERR_ACCESS_DENIED in Android Webview with sdk 30
How to Exit android app on back pressed?
What is Intent? What is the difference between an implicit intent and an explicit intent?
How to copy database from assets folder in android using kotlin
How to save activity State in Android?
How to get a contact image using a phone number in android?
Fix Behavior Subclass BottomSheetBehavior Exception - RRutors
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.
How do i load image from drawable folder in Jetpack Compose?
How to validate email address in Android with Kotlin?
How do I generate random numbers in Dart?
Check List for Generate Signed APK Android
How to get screen size (width,height) in Android?
Invoke-customs are only supported starting with android 0 --min-api 26
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
How to start a new activity on button click
Fix Play Store Rejection Due to SMS Permission - RRutors
What is Android Fragments?
What is "shared preferences" in Android ?
Fix Android Emulator Kill Error When Running Your App
Fix Duplicate Files in APK Build.gradle Issue - RRutors
How do I check in SQLite whether a table exists?
How to get an image resource by it's name in android?
How can i comment inside xml file in android studio?
Explain Fragment Life Cycle
Set Activity to Fullscreen Mode in Android - RRutors
How to convert milli seconds to hours, minutes and seconds in Android?
How to Use Deprecated Handler() in Android - RRutors Guide
What is Context?
Key Points to remember while develop the Android Application.
Hide/Disable soft keyboard on Activity launch: Android
How to stop EditText focus at Activity startup in Android?
Permission denied for window type 2010 in Marshmallow device
What is ANR in android?
How to find Android Device UDID or unique ID?
Add Jar/Library Files as Dependency in Android Studio
What are the notifications available in android?