简体   繁体   中英

How to show images fast? I'm using Picasso but it is so slow. Can I show images fast like the Instagram app?

I just want new method for fast image upload. Can you tell us the best way for you to know? I want the images to be loaded at the same time as xml. :)

Well, image loading and rendering is time & resource consuming process. Rendering image and then displaying faster can depend on multiple factors :

  1. Image resolution

  2. Image size

  3. Network strength

  4. Android device

  5. Algorithm used by Library for rendering

Hence, you should consider above mentioned points for image rendering on Android device.

Moreover, if you are unsatisfied with Picasso library you can try Glide

It is one of the most efficient libraries available in the market today.

Or you can also use Fresco

In addition to using these libraries, you can also improve your codebase for image loading by following below mentioned points:

  1. Save images or image urls to your local cache directory and avoid making API call each time for loading an image. You should only make API call if imageurl has been modified in the API response.

  2. Show proper placeholder image in case of error in image loading/rendering.

  3. Show proper default placeholder image when image is unavailable/missing .

  4. Use proper images resolutions . Like if you have to show a thumbnail image, then you should show thumbnail image and not full resolution image. Multiple resolutions for an image can be can be thumb, low, normal, high and they should have separate urls.

  5. Use compressed images.

  6. Blur thumbnail image before loading actual image.

Glide is very good about it. However, because the event shows shape according to the size and intensity of the photo, it will be healthier for you to optimize it on the backend side.

You can read about it here: Glide Vs Picasso

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM