From the course: Complete Guide to Android Development with Kotlin for Beginners
Unlock the full course today
Join today to access over 24,400 courses taught by industry experts.
Solution: Load a network image
From the course: Complete Guide to Android Development with Kotlin for Beginners
Solution: Load a network image
(upbeat music) - [Instructor] Let's jump into my solution to the load a network image challenge. For this challenge, I wanted you to start with a sample project from the exercise files, and then add the needed code to support the following action. Clicking on the switch button toggles the display of two images that are loaded from the network. So here in our emulator we have the on state, and then we have the off state. And clicking on the switch button will toggle between the two. This required getting to know a new library, coil. Coil is well documented and intuitive. Here in the Jetpack compose section, you simply need to add the dependency and then use the async image composable to load and display an image. Since we weren't looking for anything fancy yet, we could directly pass in a string that contained our desired image URL, and this would be provided as the input to the model parameter. Is that what you did? I hope so. Let's move back to the app to see my solution. Here inside…
Contents
-
-
-
-
-
-
-
-
-
-
(Locked)
Display image resources4m 11s
-
(Locked)
Load image resources at runtime3m 36s
-
(Locked)
Reduce file size with WebP images2m 55s
-
(Locked)
Use XML-based VectorDrawable images3m 55s
-
(Locked)
Create icons in Android Studio2m 58s
-
(Locked)
Challenge: Load a network image1m 55s
-
(Locked)
Solution: Load a network image2m 39s
-
(Locked)
-
-
-
-
-
-
-
-
-
-
-
-