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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T10:24:07+00:00 2026-06-09T10:24:07+00:00

I have a list that pulls image urls from a database. Once it gets

  • 0

I have a list that pulls image urls from a database. Once it gets the urls, I use the following code to store them on drawables:

 private Drawable LoadImageFromWebOperations(String url){
    try{
        InputStream is = (InputStream) new URL(url).getContent();
        Drawable d = Drawable.createFromStream(is, "src name");
        return d;
    }catch (Exception e) {
        System.out.println("Exc="+e);
        return null;
    }
}

then I save the drawable into a linked list and continue on pulling the other image urls, once this is done the pictures get displayed. The problem that I am having is that it pulls the urls fine but when it gets displayed on the app the first two pictures are good but when i scroll to see the third one it displays the picture of the first one, any thoughts on this??

Here is the code for the getview and the custom list:

private class RowData {

    protected int mId;
    protected String mTitle;

    RowData(int id,String title){
    mId=id;
    mTitle = title;
    }
    @Override
    public String toString() {
            return mId+" "+mTitle+" ";
    }
}


private class CustomAdapter extends ArrayAdapter<RowData> {

    public CustomAdapter(Context context, int resource,
                    int textViewResourceId, List<RowData> objects) {
            super(context, resource, textViewResourceId, objects);

    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
            ViewHolder holder = null;

            TextView title = null;
            TextView date = null;
            TextView detail = null;
            ImageView i11=null;
            String postDate;

            RowData rowData= getItem(position);

            if(null == convertView){
                    convertView = mInflater.inflate(R.layout.newspg, null);
                    holder = new ViewHolder(convertView);
                    convertView.setTag(holder);                   
            }
            holder = (ViewHolder) convertView.getTag();    

            title = holder.gettitle();     
            title.setText(rowData.mTitle);
            postDate = getpostDate(news, rowData.mTitle );
            Log.i("Date",postDate);
            date = holder.getDate();     
            date.setText(postDate);



            i11=holder.getImage(position);
            Log.i("pos",Integer.toString(position));
            //i11.setImageResource(imgid[0]);

            return convertView;
    }




    private class ViewHolder {      
        private View mRow;
        private TextView title = null;
        private TextView date = null;
        private TextView detail = null;
        private ImageView i11=null;            

            public ViewHolder(View row) {
            mRow = row;
            }

            public TextView gettitle() {
                    if(null == title){
                            title = (TextView) mRow.findViewById(R.id.title);
                    }
                    return title;
            }

            public TextView getDate() {
                if(null == date){
                        date = (TextView) mRow.findViewById(R.id.date);
                }
                return date;
        }


            public ImageView getImage(int position) {
                if(null == i11){

                    i11 = (ImageView) mRow.findViewById(R.id.img); 

                    i11.setImageDrawable(newArtists.get(position).getNewsPic());

            }

            return i11;
    }

}
}
  • 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-09T10:24:09+00:00Added an answer on June 9, 2026 at 10:24 am

    This is happening because the listview reuse the previous rows (with the views including your pictures) to build the new ones. So you have to take care about that. For example, you can hide the ImageView until you get the good picture to put it in the ImageView and then make it visible.

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

Sidebar

Related Questions

I have have successfully set up a list that pulls users from a database
I have the following that pulls through a list of suppliers: public List<tblSupplierPerformance> GetSupplierInfo(string
I have a php page that pulls data from a mysql database based on
I currently have some code that pulls down a list of users in a
I have an R script that pulls data from a MySQL database, processes it,
I have a GridView that pulls the data from an Oracle DataBase dynamically. <asp:GridView
I have the following code and that pulls a number of records based on
I have a dropdown list that pulls data from template table. I have an
I have a list that I am trying to fill with numbers from a
I have a server with a PHP script that pulls data from a source

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.