Displaying thumbnails of images (present at different locations in the sdcard) in a listview
I have several images present in different folders in my sdcard. I would like to display a list of thumbnails. So what I have done is while rendering any row in the list I read the file in an input stream, get the byte array, decode it to obtain a bitmap and set it in an imageview.
So far so good. But when I scroll the list, the list scrolls in jerks. I b开发者_StackOverflow社区elieve this is because decoding a bitmap from byte array takes some time. What I would like to know is that, is there any optimization which I can do to improve the performance, or better still is there any better method to achieve what I want ?
The better way in my opinion would be to add them to your resources folder as a drawable if you can. Then you can access them as a R.drawable system resource way faster.
ImageView iv;
iv.setBackgroundDrawable(getResources().getDrawable(R.drawable..));
精彩评论