0

I have an app. it has a recyclerView on main screen .

enter image description here

in recyclerView Item layout I have ImageView. the ImageView size is must be responsive. I want to set the images sizes based on screen size. when I received the json images link from server , I do not have any local resources. so I could not put them in mdpi-hdpi-xhdpi-... folders. I want to know what is the standard way for loading images that is received in json format from server . I read a article in this link:

What size to store image on server to use with Android app

my friends says you should fetch all images sizes from servers in json format and make decision what you want to load.

in this link He said send the density to server and it makes decision what is best size for your device.

which one is the most common way ?

If I load all images sizes from server , Should I check density of the device to load which one ?

NimaAzhd
  • 162
  • 3
  • 15

1 Answers1

1

Not a full answer but in general the device should only have to do one request for getting images, using a library like Glide.

You could use device density to determine the size that you want to ask for, but you and the server should both know beforehand where you can find the url or rather what suffix you have to use to find the lower/higher quality image.

Libraries like Glide handle a lot for you so I would recommend trying all of the features that it provides (like caching) and then afterwards checking if imagesize is really something that you need to optimize.

Especially at the start I wouldn't worry too much about it in small apps because there isn't going to be a noticable difference for users/server load anyways.

Merthan Erdem
  • 5,598
  • 2
  • 22
  • 29