From the course: Android Development Essential Training: 2 User Interface Design

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Solution: Load a network image

Solution: Load a network image - Android Tutorial

From the course: Android Development Essential Training: 2 User Interface Design

Start my 1-month free trial

Solution: Load a network image

(upbeat music) - [Instructor] Welcome back. Let's jump into my solution to the load and network image challenge. For this challenge, I wanted you to start with a sample project from the exercise files and add the needed code to support the following action. Clicking on the switch button toggles the images that are loaded from the network. This required getting to know a new library, Coil. Coil is well documented and intuitive. On the homepage of their website there's a quick start section. Since we're not looking for anything fancy yet, we can use the load extension function directly by passing in a string which contains our desired image URL. Is that what you did? I hope so. Let's move over to the app to see my solution. Here in the onCreate method of our main activity class, we'll first create an OnCheckChangeListener for the switch. We do that there on line number 17. Then inside of this listener, we'll check…

Contents