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 Set Text Color Programmatically Android TextView?
How to install/ uninstall apk by command line ADB
Permission denied for window type 2010 in Marshmallow device
How to Generate signed apk with android studio
What are the notifications available in android?
Add Jar/Library Files as Dependency in Android Studio
How to avoid multiple button click at same time in android?
Check List for Generate Signed APK Android
What is Intent? What is the difference between an implicit intent and an explicit intent?
Fix Play Store Rejection Due to SMS Permission - RRutors
Android Studio project R can't find
What is Context?
What is NetworkOnMainThread Exception?
How to check Android version?
FCM Not Receiving Notifications in Android - RRutors
How to find Android Device UDID or unique ID?
What are Android Versions available?
How to convert milli seconds to hours, minutes and seconds in Android?
What happens next when the device switches between portrait and landscape?
Hide/Disable soft keyboard on Activity launch: Android
Explain Fragment Life Cycle
How can i comment inside xml file in android studio?
What is ANR in android?
What is ANR? How to avoid and resolve it?
ERR_ACCESS_DENIED in Android Webview with sdk 30
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.
Set Activity to Fullscreen Mode in Android - RRutors
What is the Different Between val and var in Kotlin?
Invoke-customs are only supported starting with android 0 --min-api 26
Symmetric vs Asymmetric Encryption in Android Server - RRutors
How do I generate random numbers in Dart?
Key Points to remember while develop the Android Application.
How to reduce APK package size?
How to Get bitmap from drawable: Android
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
How to stop EditText focus at Activity startup in Android?
How to validate email address in Android with Kotlin?
Fix Android Emulator Kill Error When Running Your App
How to Exit android app on back pressed?
How do I check in SQLite whether a table exists?