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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T23:17:03+00:00 2026-06-14T23:17:03+00:00

Currently am using Zonghai-li’s android-http-image-manager but the problem I am facing is that when

  • 0

Currently am using Zonghai-li’s android-http-image-manager but the problem I am facing is that when the image is getting downloaded and at that moment when I scroll the grid-view list, that image get displayed in some other grid-cell. Can someone help me out with this issue..?

This is my adapter class :

package com.syncusup.list.adapters;

import java.io.File;
import java.util.ArrayList;

import android.app.Activity;
import android.content.Context;
import android.graphics.Bitmap;
import android.net.Uri;
import android.os.Environment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Filter;
import android.widget.ImageView;
import android.widget.TextView;

import com.syncusup.R;
import com.syncusup.UILApplication;
import com.syncusup.httpimageloader.HttpImageManager;
import com.syncusup.model.VCard;
import com.syncusup.utils.SyncLocalDatabase;

public class LocalContactsAdapter extends ArrayAdapter<VCard> {

    private LayoutInflater mInflater;

    private ArrayList<VCard> mOriginalList;

    private ArrayList<VCard> mContactList;

    private HttpImageManager mHttpImageManager;

    private MyFilter mFilter;

    private Context mContext;

    private File aFileToCheck;

    public LocalContactsAdapter(Context iContext, ArrayList<VCard> iVcardsArray) {
        super(iContext, R.layout.localcontacts_row, iVcardsArray);
        this.mContactList = new ArrayList<VCard>();
        this.mContactList.addAll(iVcardsArray);
        this.mOriginalList = new ArrayList<VCard>();
        this.mOriginalList.addAll(iVcardsArray);
        this.mContext = iContext;
        mHttpImageManager = ((UILApplication)((Activity)mContext).getApplication())
                .getHttpImageManager();
    }

    private class ViewHolder {
        public TextView aContactName;

        public TextView aContact;

        public ImageView aContactImage;
    }

    @Override
    public Filter getFilter() {
        if (mFilter == null) {
            mFilter = new MyFilter();
        }
        return mFilter;
    }

    @Override
    public int getPosition(VCard iItem) {
        return super.getPosition(iItem);
    }

    @Override
    public int getCount() {
        return mContactList.size();
    }

    @Override
    public VCard getItem(int iPosition) {
        return mContactList.get(iPosition);
    }

    @Override
    public long getItemId(int iPosition) {
        return iPosition;
    }

    @Override
    public View getView(final int iPosition, View iConvertView, ViewGroup iParent) {

        final ViewHolder aHolder;
        aFileToCheck = new File(Environment.getExternalStorageDirectory() + "/SyncUsUp/",
                SyncLocalDatabase.computeHashedName(mContactList.get(iPosition).getID()));

        if (iConvertView == null || iConvertView.getTag() == null) {
            // default layout inflater
            mInflater = (LayoutInflater)mContext.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
            iConvertView = mInflater.inflate(R.layout.localcontacts_row, null);
            aHolder = new ViewHolder();
            aHolder.aContactName = (TextView)iConvertView.findViewById(R.id.tvMyContactName);
            aHolder.aContact = (TextView)iConvertView.findViewById(R.id.tvMyContact);
            aHolder.aContactImage = (ImageView)iConvertView.findViewById(R.id.ivContact);
            iConvertView.setTag(aHolder);
        } else {
            aHolder = (ViewHolder)iConvertView.getTag();
        }

        ImageView aImageView = aHolder.aContactImage;
        aImageView.setImageResource(R.drawable.contact_box_blanktile);

        try {
            if (mContactList.get(iPosition).getPhoto() != null) {
                Bitmap aBitmap = mHttpImageManager.loadImage(new HttpImageManager.LoadRequest(Uri
                        .parse(mContactList.get(iPosition).getPhoto().getUrl()), aImageView));
                if (aBitmap != null) {
                    aImageView.setImageBitmap(aBitmap);
                }
            } else if (aFileToCheck.exists()) {
                Bitmap aBitmap = mHttpImageManager.loadImage(new HttpImageManager.LoadRequest(Uri
                        .parse(mContactList.get(iPosition).getID()), aImageView));
                if (aBitmap != null) {
                    aImageView.setImageBitmap(aBitmap);
                }

            }
        } catch (Exception iException) {
            iException.printStackTrace();
        }

        if (mContactList.get(iPosition).getFullName() != null) {
            aHolder.aContactName.setText(mContactList.get(iPosition).getFullName());
        } else {
            aHolder.aContactName.setText("No Name");
        }

        return iConvertView;
    }

    private class MyFilter extends Filter {

        @Override
        protected FilterResults performFiltering(CharSequence iConstraint) {

            FilterResults aResult = null;
            try {
                iConstraint = iConstraint.toString().toLowerCase();
                aResult = new FilterResults();
                if (iConstraint != null && iConstraint.toString().length() > 0) {
                    ArrayList<VCard> aFilteredItems = new ArrayList<VCard>();

                    for (int i = 0, l = mOriginalList.size(); i < l; i++) {
                        VCard aList = mOriginalList.get(i);
                        if (aList.getFullName() != null) {
                            if (aList.getFullName().toString().toLowerCase().contains(iConstraint))
                                aFilteredItems.add(aList);
                        }
                    }
                    aResult.count = aFilteredItems.size();
                    aResult.values = aFilteredItems;
                } else {
                    synchronized (this) {
                        aResult.values = mOriginalList;
                        aResult.count = mOriginalList.size();
                    }
                }
            } catch (Exception iException) {
                iException.printStackTrace();
            }
            return aResult;
        }

        @SuppressWarnings("unchecked")
        @Override
        protected void publishResults(CharSequence iConstraint, FilterResults iResults) {
            try {
                mContactList = (ArrayList<VCard>)iResults.values;
                notifyDataSetChanged();
                clear();
                for (int i = 0, l = mContactList.size(); i < l; i++)
                    add(mContactList.get(i));
                notifyDataSetInvalidated();
            } catch (Exception iException) {
                iException.printStackTrace();
            }
        }
    }
}
  • 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-14T23:17:04+00:00Added an answer on June 14, 2026 at 11:17 pm

    This issue is due to view reusing by the grid. That is, the views used to display data in first page of grid is reused to show data when it is called. Actually, the image downloading library should handle this change and do it correctly. Better to go for another library to lazy load images.

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

Sidebar

Related Questions

Currently using: @^(ht|f)tp(s?)\:\/\/[0-9a-zA-Z]([-.\w]*[0-9a-zA-Z])*(:(0-9)*)*(\/?)([a-zA-Z0-9\-\.\?\,\'\/\\\+&amp;%\$#_]*)?$ How can i make http:// not compulsory but if it does
I'm currently using http://benalman.com/projects/jquery-hashchange-plugin/ and I noticed that my hashes show up as /#page
Currently using HtmlUnit. Getting first login page is no problem, succesfully logging in, getting
Currently using Google Analytics as a supplement to our paid tracking software, but neither
I currently using android NDK to write some native code in C. I have
currently using spring 'exposedContextBeanNames' to allow me to display properties in my view but
Currently using Chrome v19.0.1084.46 (Official Build 135956) beta-m jqGrid 4.3.2 (latest release) The problem
Im currently using jquery to link all td's to the edit link but i
Im currently using base64_encode for some $_GET params that i don't want regular user
Im currently using a script (that is working) where I can apply a certain

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.