MithPaul MithPaul - 1 year ago 79
Android Question

How to resize images at runtime for different screens?

I know that in Android Studio there are some plugins for including a drawable that help in creating a ldpi, mdpi, hdpi, etc image resource.

But suppose I have an app in which some users upload images to a server and then I download the images and display them for other users, how can I adapt them so that they adapt to ldpi, mdpi, hdpi screens? Is there a library that runs on the server or client?

Answer Source

there are two ways , either you do it or let other do it

  1. you can use picasso(image loading library ) with fit function and just relax .link

  2. find the required size and compress the image size with required guide

there are couple of other library like picasso,glide,universal image loader and lot other though picasso and glide are most popular among android developers

Code Reference Links :


Picasso library to download images

Resize image to full width and fixed height with Picasso


Load image from SD card using Glide

Pros of libs :

  • In-Build image downloading mechanism with other features like animation,re-sizing etc
  • In-Build cache mechanism
  • Optimized written code by experienced coders
  • Can load images to bitmap , from resources etc

Cons :

  • Stay in touch with docs for new updates and more consistent features
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download