How do you handle Bitmaps in Android as it takes too much memory?

Technology CommunityCategory: AndroidHow do you handle Bitmaps in Android as it takes too much memory?
VietMX Staff asked 3 years ago

There are a number of reasons why loading bitmaps in your Android app is tricky:

  • Bitmaps can very easily exhaust an app’s memory budget.
  • Loading bitmaps on the UI thread can degrade your app’s performance, causing slow responsiveness or even ANR messages.
  • If your app is loading multiple bitmaps into memory, you need to skillfully manage memory and disk caching.

For most cases, we recommend that you use the Glide library to fetch, decode, and display bitmaps in your app. Glide abstracts out most of the complexity in handling these and other tasks related to working with bitmaps and other images on Android.