Skip to content
Advertisement

what is the best way to show a multiple images in android studio?

I have a multiple images about 600 image I want to use it for page in viewPager. I put it all in drawable but it’s take space what is the best way to store image?

Advertisement

Answer

Uploading them to a Cloudstorage (or Discord) and then loading the images with their links using Coil or Glide would be a way.

As a Kotlin-User Coil is the way to go. It’s very lightweight, for additional functionalities (like animating Gifs, loading SVGs) take a look here.

Dependency:

JavaScript

Load image from Url (trailing Lambda is optional):

JavaScript

If You only have one Imageview per Page inside your Viewpager, You might create an Array with all the Urls given and then load them like so:

JavaScript

If you prefer using Java, then go for Glide:

Dependency:

JavaScript

Load image from Url (the options are optional):

JavaScript

Load the image whenever another page is selected.

JavaScript

Hope it helps 🙂

User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement