solikentucky.blogg.se

Loading image
Loading image















Your app will also handle network errors gracefully.ĭisplaying a photo from a web URL might sound straightforward, but there is quite a bit of engineering to make it work well. Your app will use the Coil library to load and display the images, and a RecyclerView to create the grid layout for the images. The images are part of the data that your app retrieved from the Mars web service. The version of the app you will build in this codelab fills in the overview page, which displays Mars photos in a grid of images. These Kotlin objects contain the URL's of the real-life photos from Mars surface captured from NASA's Mars rovers. The MarsPhotos app connects to a web service to retrieve and display the number of Kotlin objects retrieved using Retrofit.

loading image

In this codelab, you will continue working with the app from the previous codelab called MarsPhotos. A computer with a modern web browser, such as the latest version of Chrome.Add status and error handling to the RecyclerView.Use a RecyclerView to display a grid of Mars images.Add a loading animation and error icon to the app.Modify the MarsPhotos app to get the image URL from the Mars data, and use Coil to load and display that image.

#LOADING IMAGE HOW TO#

How to handle potential errors as the images download and display.How to use a RecyclerView and a grid adapter to display a grid of images.How to use the Coil library to load and display an image from a web URL.How Adapter, ViewHolder, and DiffUtil work.How to construct a grid layout with a RecyclerView.How to retrieve JSON from a REST web service and parse that data into Kotlin objects using the Retrofit and Moshi libraries.

loading image

You also revisit how to build a RecyclerView and use it to display a grid of images on the overview page. In this codelab, you build on that knowledge to load and display photos from a web URL. In the previous codelab, you learned how to get data from a web service and parse the response into a Kotlin object.















Loading image