skinnybrit51
skinnybrit51

Reputation: 4927

how do you lazy load images into listview

I can not find a good answer for setting an imageview inside a listview

I am using asynctask to get the images.

I am using an arrayadapter for my list view.

In my array adapter in getView i set the id of the view to my object id.

As the fetched images return from the server I do the following to update the view with the image.

private void populateListImage(Bitmap bitmap, long id) {
    View view = m_findByRegionList.findViewById((int) id);
    if (view != null) {
        ViewHolder viewHolder = (ViewHolder) view.getTag();
        viewHolder.image.setImageBitmap(bitmap);
    }
}

1st problem: This is really slow.

2nd problem: setting the view id to my object id must be wrong

Upvotes: 0

Views: 736

Answers (1)

ACC
ACC

Reputation: 2560

I used this, works perfectly fine load images

Upvotes: 1

Related Questions