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());
What is NetworkOnMainThread Exception?
How to copy database from assets folder in android using kotlin
Intent for Drive PDF Viewer - How to open PDF in Google Drive with intent
'constructor Handler()' is deprecated. Deprecated in Java, How to use Handler() class in And
How to validate email address in Android with Kotlin?
What is Intent? What is the difference between an implicit intent and an explicit intent?
What are symmetric and asymmetric encryption in the way Android interacts with the server?
How to get screen size (width,height) in Android?
What is ANR in android?
How to avoid multiple button click at same time in android?
How to Generate signed apk with android studio
What is Context?
Android FCM not receiving notifications when app is removed from background
Key Points to remember while develop the Android Application.
What is ANR? How to avoid and resolve it?
What is Android Fragments?
What is "shared preferences" in Android ?
Android Studio project R can't find
How do I generate random numbers in Dart?
How to add jar/library files as a dependency in Android studio gradle file
Android Activity FullScreen - How to set activity to fullscreen mode in Android?
Error: Use JsonReader.setLenient(true) to accept malformed JSON at line 1 column 1 path
How to start a new activity on button click
How to install/ uninstall apk by command line ADB
Explain Fragment Life Cycle
What happens next when the device switches between portrait and landscape?
Duplicate files during packaging of APK” build.gradle issue: Android Studio
How to extract date and time from Long type variable in Kotlin on Android "
INSTALL_FAILED_INVALID_APK: Split lib_slice_9_apk was defined multiple times. It is possible that th
Could not inflate Behavior subclass android.support.design.widget. BottomSheetBehavior How resolve
How do i load image from drawable folder in Jetpack Compose?
What is the Different Between val and var in Kotlin?
How to find Android Device UDID or unique ID?
Hide/Disable soft keyboard on Activity launch: Android
ERROR Android emulator gets killed when I try to run my application and choose an emulator it ret
What is Application?
How to get complete address from latitude and longitude?
How do I check in SQLite whether a table exists?
How to Exit android app on back pressed?
Emulator: emulator: ERROR: Can't find 'Linux version ' string in kernel image file: Andr