views:

112

answers:

1

Hi all, 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 believe 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 ?

A: 

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..));
sadboy
I can't put the images in the resource folder, since the number of images will change from time to time. Also this would tend to increase the app size significantly
frieza