1

I'm working on an Android app. It pretends to be for many countries, so I need to change some icons, and "drawables" according to the user's country that has logged-in to the app like user's country Mobile Operators, maybe country's flag, etc.

I was planing to get those restfully through an URL on the web service (using Volley).

But, talking about Android's multiple screen densities, I don't know if in this case is "valid" to get ONE single image size from the service to put it on the app, or depending on the device's screen density then request the respective images to the server (if it is a good practice).

How have you proceeded on these cases? Any comment I will really appreciate, thanks!!

josher932
  • 490
  • 1
  • 7
  • 20

3 Answers3

1

I believe the case you have described is a valid and good approach.

You can simply parse the images into the applicable screen densities on your server, then pull them into your app based on the file naming or sorting conventions. i.e. density = getDensity -> Pull images from images/density

Alternatively, if these images are sufficiently small, you could perform the resizing in-app after the pull to simplify the process using BitmapFactory methods.

Demonsoul
  • 791
  • 4
  • 11
0

for sizes you want to stay the same you can use in/mm/pt. see more like this on: What is the difference between "px", "dp", "dip" and "sp" on Android?

Community
  • 1
  • 1
Just_someone
  • 1,293
  • 1
  • 11
  • 13
0

Just to close this question, I'm going to answer it based on what I've been lately when fetching images from server:

As Google recommends: https://youtu.be/HY9aaXHx8yA?t=4m4s

I use Picasso to fetch images from internet. This library handles all resizing and caching very cool and simplifies everything. It can be used even with local resouces.

I recommend using this library for this task.

Cheers.

josher932
  • 490
  • 1
  • 7
  • 20