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());
What happens next when the device switches between portrait and landscape?
Set Activity to Fullscreen Mode in Android - RRutors
How to Exit android app on back pressed?
How can i comment inside xml file in android studio?
What is ANR in android?
Fix Play Store Rejection Due to SMS Permission - RRutors
What is the Different Between val and var in Kotlin?
Permission denied for window type 2010 in Marshmallow device
How do I generate random numbers in Dart?
What is "shared preferences" in Android ?
How to find Android Device UDID or unique ID?
Explain Fragment Life Cycle
FCM Not Receiving Notifications in Android - RRutors
Android Studio project R can't find
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.
Fix Behavior Subclass BottomSheetBehavior Exception - RRutors
Fix Duplicate Files in APK Build.gradle Issue - RRutors
What is Context?
How to copy database from assets folder in android using kotlin
How to get an image resource by it's name in android?
What is NetworkOnMainThread Exception?
How to convert milli seconds to hours, minutes and seconds in Android?
How to convert DP to Pixel and Pixel to Dp?
Fix Android Emulator Kill Error When Running Your App
How to check Android version?
What is Android?
How to get screen size (width,height) in Android?
Key Points to remember while develop the Android Application.
ERR_ACCESS_DENIED in Android Webview with sdk 30
How to stop EditText focus at Activity startup in Android?
What is Application?
How to reduce APK package size?
What is Android Fragments?
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
How to validate email address in Android with Kotlin?
How to Get bitmap from drawable: Android
Symmetric vs Asymmetric Encryption in Android Server - RRutors
Add Jar/Library Files as Dependency in Android Studio
How to save activity State in Android?
Extract Date and Time from Long Type Variable - RRutors