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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T05:05:32+00:00 2026-06-16T05:05:32+00:00

In my app i have a listAdapter where iam loading the phonenumbers and their

  • 0

In my app i have a listAdapter where iam loading the phonenumbers and their images from phonebook, as follows

 public ProfileAdapter(Activity activity, int textViewResourceId, List<Profile> listCont,int renderer, String profileType) {
        super(activity, textViewResourceId, listCont);
        this.renderer = renderer;
        this.listCont = listCont;
        this.activity = activity;
        this.profileType=profileType;
    }

    public class ViewHolder {
        View rowView;
        public TextView textEmailId;
        public TextView textContNo;
        public TextView text;
        public QuickContactBadge photo;
        public ViewHolder(View view)
        {
             rowView = view;
        }
        public TextView getTextView()
        {
             if(text ==null)
                   text = (TextView) rowView.findViewById(R.id.name);
             return text;
        }
        public TextView getTextView1()
        {
             if(textContNo ==null)
                 textContNo = (TextView) rowView.findViewById(R.id.contactno);
             return textContNo;
        }
        public TextView getTextView2()
        {
             if(textEmailId ==null)
                 textEmailId = (TextView) rowView.findViewById(R.id.emailId);
             return textEmailId;
        }
        public QuickContactBadge getQuickContactBadge()
        {
             if(photo ==null)
                 photo = (QuickContactBadge) rowView.findViewById(R.id.quickContactBadge1);
             return photo;
        }

    }


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

    View view = convertView; 
    ViewHolder holder;

    if (view == null) { 
    LayoutInflater inflater = (LayoutInflater) (getContext() 
    .getSystemService(Context.LAYOUT_INFLATER_SERVICE)); 
    view = inflater.inflate(renderer, null); 

    holder = new ViewHolder(view);

 holder.text = (TextView) view.findViewById(R.id.name); 
 holder.textContNo = (TextView) view.findViewById(R.id.contactno); 
 holder.textEmailId = (TextView) view.findViewById(R.id.emailId);  
 holder.photo = (QuickContactBadge ) view.findViewById(R.id.quickContactBadge1);

 view.setTag(holder);
    } else {
        holder =(ViewHolder) view.getTag();
    }

 Profile contact = listCont.get(position); 
    holder.text.setText(contact.getName()); 

    QuickContactBadge photo = (QuickContactBadge ) view.findViewById(R.id.quickContactBadge1);  
    photo.setTag(contact.getMobileNo()); 
    new LoadImage(photo).execute(contact.getMobileNo()); 

    contact.getName(); 
    contact.getId(); 
        holder.textContNo.setText(contact.getNumber());
        holder.textEmailId.setText(contact.getEmail());
        return view;
    }

and iam loading the images using the asynctask as below

  class LoadImage extends AsyncTask<String, Void, Bitmap>{ 

        private QuickContactBadge qcb; 

        public LoadImage(QuickContactBadge qcb) { 
        this.qcb= qcb; 
        } 
        @Override 
        protected Bitmap doInBackground( final String... params) { 
        activity.runOnUiThread(new Runnable() { 
        public void run() { 
        new QuickContactHelper(activity, qcb, (String) params[0]).addThumbnail(); 
        } 
        }); 
        return null; 
        } 
        @Override 
        protected void onPostExecute(Bitmap result) { 

        } 

iam facing the problem while scrolling the list view each time i scroll iam the images are changing for each contact, also scrolling is not smooth. i dnt know what am i doing wrong in code .Any help is 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-06-16T05:05:34+00:00Added an answer on June 16, 2026 at 5:05 am

    It’s running very slow because you’re not executing anything on the background thread.

        activity.runOnUiThread(new Runnable() { 
        public void run() { 
        new QuickContactHelper(activity, qcb, (String) params[0]).addThumbnail(); 
        } 
        }); 
    

    you’re just asking to re-execute back on the UI thread.

    The image keeps changing because it shows the image that was before you scroll, and after that process completes it puts the new image. You should on the getView put some blank image or image placeholder so it will be blank, then the image.

    Also try do some caching. Check the LruCache.

    edit:

    I’ve never worked with the QuickContactBadge before I’ll write how I would do code for ImageView and you can change the necessary parts.
    inside the getView

    public View getView(int position, View convertView, ViewGroup parent) {
       // all that processing to get the data then...
       img.setImageResource(R.id.blank_user); // put something image placeholder (blank)
       new LoadImage(img).execute(url); // download
    
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In my app, I am loading images from url's in listview. And onclick of
In my app have a sign in activity. If login is successful, I start
We have App A as main app. Now we build from it App B
I have an android-app with a listview in an activity. The listview has, if
I have an Activity with a list that is bound to a ListAdapter reading
I have to do android app which includes Gallery with GridView and images should
I have an app which reads some data from JSON, and I have 2
Im making an app that shows images from a Tumblr account. It loads the
I have an Ipad app what has multiple OpenGL tile images, couple buttons in
My app have a background image that fills the screen. I'd like to display

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.