Hello,
I have a listview with 100-500 row, each row can contain three images.
Here, my getview :
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
View vi = convertView;
ViewHolder holder;
int index = position * rowNumber;
if (convertView == null)
{
holder=new ViewHolder();
vi = inflater.inflate(R.layout.lib_list_cell, null);
holder.couv1 = (ImageView)
vi.findViewById(R.id.libCellCouv1);
holder.couv2 = (ImageView)
vi.findViewById(R.id.libCellCouv2);
holder.couv3 = (ImageView)
vi.findViewById(R.id.libCellCouv3);
vi.setTag(holder);
}
else
holder = (ViewHolder) vi.getTag();
String couv = mld.getCouvURL(index);
if (holder.couv1.getTag() == null || (couv.compareTo((String)
holder.couv1.getTag()) != 0))
{
holder.couv1.setTag(couv);
imgLoad.displayImage(couv, contex, holder.couv1,
couvMaxHeight, couvMaxWidth, ImageLoader.DISK_CACHE_TEMPO, false);
}
couv = mld.getCouvURL(index + 1);
if (holder.couv2.getTag() == null || (couv.compareTo((String)
holder.couv2.getTag()) != 0))
{
holder.couv2.setTag(couv);
imgLoad.displayImage(couv, contex, holder.couv2,
couvMaxHeight, couvMaxWidth, ImageLoader.DISK_CACHE_TEMPO, false);
}
couv = mld.getCouvURL(index + 2);
if (holder.couv3.getTag() == null || (couv.compareTo((String)
holder.couv3.getTag()) != 0))
{
holder.couv3.setTag(couv);
imgLoad.displayImage(couv, contex, holder.couv3, couvMaxHeight,
couvMaxWidth, ImageLoader.DISK_CACHE_TEMPO, false);
}
return vi;
}
My listview is slow, in my opinion because the two setImageBitmap of
my ImageLoader.
For exemple, with :
public void DisplayImage (String url, Context context, ImageView
imageView, int maxH, int maxW, int diskSave, boolean littreLogo)
{
if (url != null)
{
queuePhoto(imageView.getTag().toString(), context, imageView,
maxH, maxW, diskSave);
if (imageView != null)
imageView.setImageBitmap(null);
}
}
it's slow, but if i comment imageView.setImageBitmap(null); it's
already faster!
(If i remove also the final imageView.setImageBitmap(bmp); it's
perfect)
Any ideas for solve this?
(I work on HoneyComb 3.0 with hardware accelerated.)
Thanks !
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en