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 8667557
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T17:59:33+00:00 2026-06-12T17:59:33+00:00

my ListView seems to be working correctly when the images loaded can be viewed

  • 0

my ListView seems to be working correctly when the images loaded can be viewed on the screen. but when i add a new item with no image, and the item is out of view, the ListView keeps loading an image for it. i am using a custom arrayadapter.

 int resource;
        private RecipeClasses mRecipeClass;
        private Recipe mRecipe;
        private Context context;
        Uri path;

    public RecipeAdapter(Context context, int _resource, List<Recipebag> items)
    {
        super(context, _resource, items);
        resource = _resource;
        mRecipeClass = new RecipeClasses(context);
        this.context = context;
        mRecipe = new Recipe(context);
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent)
    {

        LinearLayout newView;
        Recipebag item = getItem(position);
        long id = item.getRecId();
        mRecipeClass.open();
        Cursor recipe = mRecipe.setCursorToRecipe(id);
        String name = recipe.getString(recipe.getColumnIndexOrThrow(RecipeClasses.Recipe.RECIPE_NAME));
        String image = recipe.getString(recipe.getColumnIndexOrThrow(RecipeClasses.Recipe.RECIPE_IMAGE));
        mRecipeClass.close();
        String newId = String.valueOf(id);
        if(image== null)
        {
            image = " ";
        }
        else
        {
             path = Uri.parse(image);
        }

        if (convertView == null)
        {
            // Inflate a new view if this is not an update.
            newView = new LinearLayout(getContext());
            String inflater = Context.LAYOUT_INFLATER_SERVICE;
            LayoutInflater li;
            li = (LayoutInflater) getContext().getSystemService(inflater);
            li.inflate(resource, newView, true);
        }
        else
        {
            // Otherwise we’ll update the existing View
            newView = (LinearLayout) convertView;
        }
        TextView recipe_txt = (TextView) newView.findViewById(R.id.txt_recipe_row);
        ImageView img = (ImageView) newView.findViewById(R.id.img_view_recipe);
        if(new File(image).exists())
        {
        ImageResizer img_W = new ImageResizer(context, img.getMeasuredWidth(), img.getMeasuredHeight());
        img_W.loadImage(image, img);
        }
        else if(image!= " ")

        {
            ImageResizer img_W = new ImageResizer(context, img.getMeasuredWidth(), img.getMeasuredHeight());
            img_W.loadImage(path, img);
            img.setImageURI(path);
        }
        if (recipe_txt != null)
        {
            recipe_txt.setText(name);
        }
        return newView;
    }
  • 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-06-12T17:59:35+00:00Added an answer on June 12, 2026 at 5:59 pm

    Near as I can tell, you are never clearing the content of your ImageView in getView(). Hence, when the row is recycled, it will already have an image. You need to handle the case where you have no image in getView() — try setImageDrawable(null) or something.

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

Sidebar

Related Questions

I've been trying to select an item on an external listview but it seems
Having ListView but I can customizing it only by modifying layout.xml (it's our system
So I had my listview working perfectly then I decided to add a context
I'm a little embarrassed to post this but I can't seem to figure out
It seems that android has enforced that a listview must have the name android:id=@android:id/list,
I cant seem to find out how to get my ListView (OnListItemClick), to open
My ListView item has two TextViews. I want to show one of them at
My Listview is setup in the details view with the following column headers: Image
Is it possible to apply a custom background to each Listview item via the
I have recently stumbled across an issue where the WPF ListView control seems to

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.