Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6837841
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T23:31:31+00:00 2026-05-26T23:31:31+00:00

I have a ListView which contains an ImageView and a TextView. I’m subclassing ArrayAdapter

  • 0

I have a ListView which contains an ImageView and a TextView. I’m subclassing ArrayAdapter so that I can load an image from the internet, via a subclassed AsyncTask. All good so far.

The problem is that if I try to use convertView, I have a problem where the image is recycled briefly into the wrong row. (This is a company’s logo, so this is… not good.)

If I don’t use convertView, however, the image is lost when the user scrolls. So if they scroll down and back up, the image is re-loaded from the internet (which is obviously bad for data use, battery life etc.)

Is there a simple way to fix this so that it doesn’t load from the internet each time, or move the images around?

Here’s what I’m using so far:

public class SupplierAdapter extends ArrayAdapter<Supplier>{
    int resource;
    String response;
    Context context;

    public SupplierAdapter(Context context, int resource, List<Supplier> suppliers) {
        super(context, resource, suppliers);
        this.resource = resource;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent){
    LinearLayout view;
        Supplier s = getItem(position);

        if(convertView == null){
            view = new LinearLayout(getContext());
            String inflater = Context.LAYOUT_INFLATER_SERVICE;
            LayoutInflater vi;
            vi = (LayoutInflater) getContext().getSystemService(inflater);
            vi.inflate(resource, view, true);
        } else {
            view = (LinearLayout) convertView;
        }

        ImageView iv = (ImageView) view.findViewById(R.id.thumbnail);
        // s.getThumbnail returns a URL
        new DownloadImageTask(iv).execute(s.getThumbnail()); 

        TextView titleText =(TextView) view.findViewById(R.id.titleText);
        titleText.setText(s.getTitle());
        titleText.setTag(s.getId());

        return view;
    }
}

All help very much appreciated 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T23:31:31+00:00Added an answer on May 26, 2026 at 11:31 pm

    John, try using raptureinvenice.com‘s WebImageView. I recently refactored my code to use this easy and lightweight library and so far, so good. It easily provides a two level cache, updates multiple targets simultaneously, and was incredibly easy to set up. It looks like it seems to drop about 1/20 requests to display an image. Other than this lurking bug that could be the library’s fault, it is excellent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one custom ListView which contains one ImageView and one TextView, and I
i have a ListView which contains objects bound from an collection. The representation of
I have a ListView in which each item has a complex layout that contains,
My app contains a listview which can optionally contain images from a users sd
I have a ListView which contains EMPLOYEE_NAME from a DB table EMPLOYEE. Some employees
I have a ListView which contains a text field that is populated using a
Hallo all, I have a ListView which contains a Button in each line. The
Hallo all, I have a ListView, which contains an EditText in each of it's
I have one listview.which contain one image ,text and one button .i had creted
This is probably easy as well. But I have this listview which contains exe

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.