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 get screen size (width,height) in Android?
How do I check in SQLite whether a table exists?
Symmetric vs Asymmetric Encryption in Android Server - RRutors
Invoke-customs are only supported starting with android 0 --min-api 26
Add Jar/Library Files as Dependency in Android Studio
Open PDF in Google Drive with Intent in Android - RRutors
How to save activity State in Android?
How to reduce APK package size?
Fix Android Emulator Kill Error When Running Your App
What is ANR in android?
Set Activity to Fullscreen Mode in Android - RRutors
Android Studio project R can't find
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.
How to Exit android app on back pressed?
How do I generate random numbers in Dart?
Explain Fragment Life Cycle
How to get an image resource by it's name in android?
How to start a new activity on button click
How To Set Text Color Programmatically Android TextView?
What is "shared preferences" in Android ?
How to Generate signed apk with android studio
How to copy database from assets folder in android using kotlin
How to stop EditText focus at Activity startup in Android?
How to get a contact image using a phone number in android?
How to install/ uninstall apk by command line ADB
What are Android Versions available?
How to Use Deprecated Handler() in Android - RRutors Guide
What happens next when the device switches between portrait and landscape?
Permission denied for window type 2010 in Marshmallow device
Extract Date and Time from Long Type Variable - RRutors
How to convert DP to Pixel and Pixel to Dp?
How can i comment inside xml file in android studio?
What is Context?
How to validate email address in Android with Kotlin?
What is Application?
FCM Not Receiving Notifications in Android - RRutors
What is Android Fragments?
What is the Different Between val and var in Kotlin?
How to get complete address from latitude and longitude?
What is ANR? How to avoid and resolve it?