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 a contact image using a phone number in android?
What are the notifications available in android?
What is the difference between match_parent and fill_parent?
How to convert milli seconds to hours, minutes and seconds in Android?
What is "shared preferences" in Android ?
Open PDF in Google Drive with Intent in Android - RRutors
How do I check in SQLite whether a table exists?
How To Set Text Color Programmatically Android TextView?
Android Studio project R can't find
How to Generate signed apk with android studio
Extract Date and Time from Long Type Variable - RRutors
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
How to start a new activity on button click
What is the Different Between val and var in Kotlin?
How to Use Deprecated Handler() in Android - RRutors Guide
How to Get bitmap from drawable: Android
How to reduce APK package size?
How to get screen size (width,height) in Android?
Invoke-customs are only supported starting with android 0 --min-api 26
Decompile APK Files: How to Get Source Code - RRutors Guide
Fix Android Emulator Kill Error When Running Your App
How to copy database from assets folder in android using kotlin
FCM Not Receiving Notifications in Android - RRutors
How to check Android version?
What is Intent? What is the difference between an implicit intent and an explicit intent?
What is Application?
What is Android Fragments?
How to stop EditText focus at Activity startup in Android?
ERR_ACCESS_DENIED in Android Webview with sdk 30
Hide/Disable soft keyboard on Activity launch: Android
How to avoid multiple button click at same time in android?
What is ANR? How to avoid and resolve it?
How to Exit android app on back pressed?
Fix Behavior Subclass BottomSheetBehavior Exception - RRutors
Add Jar/Library Files as Dependency in Android Studio
How can i comment inside xml file in android studio?
How to validate email address in Android with Kotlin?
Symmetric vs Asymmetric Encryption in Android Server - RRutors
What is NetworkOnMainThread Exception?
What happens next when the device switches between portrait and landscape?