简体   繁体   中英

Storing bitmaps in android studio vs fetching with url

I'm sort of new to managing memory in apps and have a question with regards to bitmaps. I have many users that can each upload a profile image to be stored in firebase storage. I'd like to be able to display these images as quickly as possible. The two options I see is

  1. Loading them in the background at start up and storing the bitmaps, then referencing them later when they're needed, or

  2. retrieving them when they're needed using Picasso or Glide and the urls (however this causes a small delay betweenAn when the page is loaded and the images are displayed, it also causes the need for more database calls).

By storing the bitmaps am I screwing myself over with regards to memory? Im testing with 10 made up users right now but if i have a 100 will the app be able to handle it?

Using Picasso or glide is the best way to load the images because they use cache as well, so there will be no unnecessary api calls. Also, they use highly optimised algorithms such as LRU, which can free the object/image which is not used for long time and clear those images from the local cache.

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