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());
Key Points to remember while develop the Android Application.
What is Android?
How to find Android Device UDID or unique ID?
How to start a new activity on button click
How to stop EditText focus at Activity startup in Android?
What is ANR in android?
Set Activity to Fullscreen Mode in Android - RRutors
How do i load image from drawable folder in Jetpack Compose?
What is Android Fragments?
What is the difference between match_parent and fill_parent?
How To Set Text Color Programmatically Android TextView?
How to install/ uninstall apk by command line ADB
How to avoid multiple button click at same time in android?
How can i comment inside xml file in android studio?
How to get a contact image using a phone number in android?
Android Studio project R can't find
Fix Play Store Rejection Due to SMS Permission - RRutors
What are the notifications available in android?
What is NetworkOnMainThread Exception?
Extract Date and Time from Long Type Variable - RRutors
Hide/Disable soft keyboard on Activity launch: Android
What is Intent? What is the difference between an implicit intent and an explicit intent?
Fix Android Emulator Kill Error When Running Your App
Permission denied for window type 2010 in Marshmallow device
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
How to get complete address from latitude and longitude?
Explain Fragment Life Cycle
How to Generate signed apk with android studio
How to convert DP to Pixel and Pixel to Dp?
How to get an image resource by it's name in android?
How to get screen size (width,height) in Android?
Fix Duplicate Files in APK Build.gradle Issue - RRutors
What are Android Versions available?
FCM Not Receiving Notifications in Android - RRutors
ERR_ACCESS_DENIED in Android Webview with sdk 30
Invoke-customs are only supported starting with android 0 --min-api 26
What is Context?
INSTALL_FAILED_INVALID_APK: Split lib_slice_9_apk was defined multiple times. It is possible that th
Decompile APK Files: How to Get Source Code - RRutors Guide