Most memory efficient way to resize bitmaps on android?

前端 未结 2 2108
迷失自我
迷失自我 2020-11-28 00:09

I’m building an image-intensive social app where images are sent from the server to the device. When the device has smaller screen resolutions, I need to resize the bitmaps,

2条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-11-28 01:01

    As nice (and accurate) as this answer is, it's also very complicated. Rather than re-invent the wheel, consider libraries like Glide, Picasso, UIL, Ion, or any number of others that implement this complex and error prone logic for you.

    Colt himself even recommends taking a look at Glide and Picasso in the Pre-scaling Bitmaps Performance Patterns Video.

    By using libraries, you can get every bit of efficiency mentioned in Colt's answer, but with vastly simpler APIs that work consistently across every version of Android.

提交回复
热议问题