In Jetpack compose example to load image from drawable folder we will use below code. In the above example we used image composable and create Painter object from painterResource() and pass the resource id. You can read more about Image composable in Jetpack compose
@Composable
fun LoadFromResourceDemo(){
val image: Painter = painterResource(id = R.drawable.image1)
Image(painter = image,contentDescription = "image",)
}
How to save activity State in Android?
Key Points to remember while develop the Android Application.
FragmentPagerAdapter deprecated, Since API 27.1.0 FragmentPagerAdapter is deprecated.
How to get complete address from latitude and longitude?
Fix Error: Use JsonReader.setLenient(true) for Malformed JSON
What happens next when the device switches between portrait and landscape?
Extract Date and Time from Long Type Variable - RRutors
ERR_ACCESS_DENIED in Android Webview with sdk 30
Android Studio project R can't find
Add Jar/Library Files as Dependency in Android Studio
Emulator: emulator: ERROR: Can't find 'Linux version ' string in kernel image file: Andr
How do I check in SQLite whether a table exists?
Permission denied for window type 2010 in Marshmallow device
What is ANR in android?
Symmetric vs Asymmetric Encryption in Android Server - RRutors
FCM Not Receiving Notifications in Android - RRutors
Explain Fragment Life Cycle
Fix Behavior Subclass BottomSheetBehavior Exception - RRutors
Set Activity to Fullscreen Mode in Android - RRutors
How to convert DP to Pixel and Pixel to Dp?
How to get screen size (width,height) in Android?
How to Exit android app on back pressed?
Fix Play Store Rejection Due to SMS Permission - RRutors
How to Use Deprecated Handler() in Android - RRutors Guide
Fix Duplicate Files in APK Build.gradle Issue - RRutors
How to validate email address in Android with Kotlin?
Hide/Disable soft keyboard on Activity launch: Android
INSTALL_FAILED_INVALID_APK: Split lib_slice_9_apk was defined multiple times. It is possible that th
How to start a new activity on button click
What is ANR? How to avoid and resolve it?
How to get a contact image using a phone number in android?
How to Generate signed apk with android studio
Invoke-customs are only supported starting with android 0 --min-api 26
What is Context?
What is NetworkOnMainThread Exception?
What is the difference between match_parent and fill_parent?
How to convert milli seconds to hours, minutes and seconds in Android?
How do i load image from drawable folder in Jetpack Compose?
Fix Android Emulator Kill Error When Running Your App
What is Intent? What is the difference between an implicit intent and an explicit intent?