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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T07:28:47+00:00 2026-05-30T07:28:47+00:00

I am getting images from background process by using url.To dispaly images i have

  • 0

I am getting images from background process by using url.To dispaly images i have used BaseAdapter for display the all images in list.I have added the BaseAdapter to my listView.

I am able to download images at back ground by using AsyncTask class this class can be return bitmap images.

I have implemented MyCustome adapter class as follows.

public class CustomeAdapter extends BaseAdapter {
 private static ArrayList<Message> searchArrayList;

 private LayoutInflater mInflater;

 public CustomeAdapter(Context context, ArrayList<Message> results) {
  searchArrayList = results;
  mInflater = LayoutInflater.from(context);




 }

 public int getCount() {
  return searchArrayList.size();
 }

 public Object getItem(int position) {
  return searchArrayList.get(position);
 }

 public long getItemId(int position) {
  return position;
 }

 public View getView(int position, View convertView, ViewGroup parent) {
  ViewHolder holder;
  if (convertView == null) {
   convertView = mInflater.inflate(R.layout.list, null);
   holder = new ViewHolder();
   holder.personName = (TextView) convertView.findViewById(R.id.usrName);
   holder.message = (TextView) convertView.findViewById(R.id.msgText);
   holder.imgPerson = (ImageView) convertView.findViewById(R.id.personImg);
   holder.msgImg = (ImageView) convertView.findViewById(R.id.msgImg);

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

  holder.personName.setText(searchArrayList.get(position).getShoutUserFirstName());
  holder.message.setText(searchArrayList.get(position).getShoutMessageText());
  holder.msgImg.setImageResource(R.drawable.smile);

  try{

  new DownloadImageTask( holder.imgPerson).execute("http://www.bwappstore.com/WebApps/ShoutImage/Image.ashx?UserID="+searchArrayList.get(position).getShoutUserID());

  }
  catch (RejectedExecutionException  e) {
    e.printStackTrace();
}
  return convertView;
 }

 static class ViewHolder {
  TextView personName;
  TextView message;
 ImageView imgPerson;
 ImageView msgImg;

 }


 private class DownloadImageTask extends AsyncTask<String, Void, Bitmap> {
        ImageView bmImage;

        public DownloadImageTask(ImageView bmImage) {
            this.bmImage = bmImage;
        }
        protected Bitmap doInBackground(String... urls) {
            Bitmap bm = null;
            try {
                URL aURL = new URL(urls[0]);
                URLConnection conn = aURL.openConnection();
                conn.connect();
                InputStream is = conn.getInputStream();
                BufferedInputStream bis = new BufferedInputStream(is);
                bm = BitmapFactory.decodeStream(bis);
                bis.close();
                is.close();
           } 
            catch (IOException e) {
               Log.e("", "Error getting bitmap", e);
           }
           return bm;
        }

        protected void onPostExecute(Bitmap result) {
            bmImage.setImageBitmap(result);
        }
}

}

from the implementation i can download the images and i can show in list view but the images are changing when i scroll those are all not fixing.those are loading again and again and over loading on image but not loading related messages images
if one image loaded then it will never load again.after some time only one image is showing in list

how can i load one image for one time then show in list?
please any body help me

  • 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-30T07:28:48+00:00Added an answer on May 30, 2026 at 7:28 am

    The problem is in your logic.

    You are executing download image tasks in adapter’s getView method which gets called every time you scroll the list.

    So if your activity is ListActivity, try executing your tasks in onStart method. Then this issue will not be seen.

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

Sidebar

Related Questions

I have used all the Standard Network related code for Getting Images of about
I am currently getting images from the 'Documents' directory (using -imageWithContentsOfFile:) with no problems
i m getting blank images using spanned from.Html. Is there any way to hide
In my project i'm getting live camera images from remote bluetooth device. and now
I want to get a thumbnail image for videos from Vimeo. When getting images
I have these images that I am getting off my server and a database
I'm trying to use threading to load an image from a url. I have
I am using jquery layout and I have a very hard time getting rid
I need to get the background image from a PowerPoint slide using java. I
I inherited a project from another developer who used jQuery UI. I've added a

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.