Android fast Bitmap loading

前端 未结 4 1323
感情败类
感情败类 2021-02-06 09:21

I have a block of images that I want to load on my screen. All the images are files that I downloaded and stored on SD-CARD.

So far I found two ways to do it, first is l

4条回答
  •  再見小時候
    2021-02-06 09:55

    1. Don't load on main thread. With 2.1 sec delay you're close to being killed with ANR (app not responding) error if you block main thread.

    2. Load in separate thread. Don't create 10 threads, but one AsyncTask, and load all your images one after another in doInBackground.

      Loading in AsyncTask should take (nearly) same time as loading in main thread. Don't put too much fancy animations, so that main thread doesn't consume too much CPU time.

提交回复
热议问题