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());
Explain Fragment Life Cycle
How to stop EditText focus at Activity startup in Android?
Fix Android Emulator Kill Error When Running Your App
Emulator: emulator: ERROR: Can't find 'Linux version ' string in kernel image file: Andr
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.
How to Exit android app on back pressed?
What is Intent? What is the difference between an implicit intent and an explicit intent?
Key Points to remember while develop the Android Application.
Symmetric vs Asymmetric Encryption in Android Server - RRutors
How to save activity State in Android?
What is Context?
Android Studio project R can't find
Extract Date and Time from Long Type Variable - RRutors
Fix Behavior Subclass BottomSheetBehavior Exception - RRutors
Open PDF in Google Drive with Intent in Android - RRutors
ERR_ACCESS_DENIED in Android Webview with sdk 30
How do I generate random numbers in Dart?
Invoke-customs are only supported starting with android 0 --min-api 26
What happens next when the device switches between portrait and landscape?
What is Application?
Fix Duplicate Files in APK Build.gradle Issue - RRutors
How do I check in SQLite whether a table exists?
Check List for Generate Signed APK Android
What are the notifications available in android?
How to Get bitmap from drawable: Android
Permission denied for window type 2010 in Marshmallow device
How to install/ uninstall apk by command line ADB
What is the Different Between val and var in Kotlin?
How to convert milli seconds to hours, minutes and seconds in Android?
What is NetworkOnMainThread Exception?
Add Jar/Library Files as Dependency in Android Studio
What is Android Fragments?
How to avoid multiple button click at same time in android?
Hide/Disable soft keyboard on Activity launch: Android
How to copy database from assets folder in android using kotlin
How To Set Text Color Programmatically Android TextView?
INSTALL_FAILED_INVALID_APK: Split lib_slice_9_apk was defined multiple times. It is possible that th
How to find Android Device UDID or unique ID?
What is Android?