Load contact photo in a listview performance

后端 未结 1 629
别那么骄傲
别那么骄傲 2020-12-16 05:56

I want to display contact\'s photo in a ListView. I am facing performance problem(Scrolling is not smooth) when there is a large number of contacts. I am using ArrayAdapter

相关标签:
1条回答
  • 2020-12-16 06:37

    When creating a view in getView() you should place a generic icon in place of photo, then start an AsyncTask to load the image in the background and return from getView() as fast as possible. Then when image is ready (AsyncTask background task is done) you replace the generic icon in the view with the loaded image.

    This way images might not show immediately, but the scrolling will be smooth.

    0 讨论(0)
提交回复
热议问题