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 do I generate random numbers in Dart?
How to reduce APK package size?
Add Jar/Library Files as Dependency in Android Studio
What is the difference between match_parent and fill_parent?
What are Android Versions available?
FCM Not Receiving Notifications in Android - RRutors
Fix Android Emulator Kill Error When Running Your App
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.
Explain Fragment Life Cycle
How to validate email address in Android with Kotlin?
What is Android Fragments?
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
Key Points to remember while develop the Android Application.
How to get a contact image using a phone number in android?
What is Context?
How to Exit android app on back pressed?
What is ANR in android?
How to get complete address from latitude and longitude?
Invoke-customs are only supported starting with android 0 --min-api 26
Fix Duplicate Files in APK Build.gradle Issue - RRutors
How do I check in SQLite whether a table exists?
How to Generate signed apk with android studio
How can i comment inside xml file in android studio?
How to check Android version?
How to copy database from assets folder in android using kotlin
Decompile APK Files: How to Get Source Code - RRutors Guide
INSTALL_FAILED_INVALID_APK: Split lib_slice_9_apk was defined multiple times. It is possible that th
What is Application?
Emulator: emulator: ERROR: Can't find 'Linux version ' string in kernel image file: Andr
What is ANR? How to avoid and resolve it?
How to avoid multiple button click at same time in android?
How do i load image from drawable folder in Jetpack Compose?
How to save activity State in Android?
ERR_ACCESS_DENIED in Android Webview with sdk 30
Set Activity to Fullscreen Mode in Android - RRutors
How to find Android Device UDID or unique ID?
Android Studio project R can't find
What is NetworkOnMainThread Exception?
How to get screen size (width,height) in Android?
How to convert milli seconds to hours, minutes and seconds in Android?