I meet the same problem when I used a class inherit from  BaseAdapter ,
My solution is set the image every time in BaseAdapter.getView().
I think this is the same of 
if(null!=iv)
                iv.setImageBitmap(bmp);
try to comment out the if(null!=iv)
                
-----Original Message-----
From: android-developers@googlegroups.com 
[mailto:android-develop...@googlegroups.com] On Behalf Of julius
Sent: Thursday, June 10, 2010 8:19 AM
To: Android Developers
Subject: [android-developers] Images in ListView in wrong places

Hi,

I have a ListView which has rows that include an ImageView. I am
populating the ImageView with the following code (getting the image
from the SDCard if available):

        Bitmap bmp = BitmapFactory.decodeFile(filename);
        ImageView iv = getCoverImageView();
        if(null!=iv)
                iv.setImageBitmap(bmp);

However when I scroll and the images are loaded they seem to turn up
in the wrong places.

The ListView is populated through a CursorAdapter:

        @Override
        public void bindView(View row, Context ctxt, Cursor c) {
                SDIReleaseWrapper wrapper = (SDIReleaseWrapper) row.getTag();
                wrapper.populateFrom(c);
        }

        @Override
        public View newView(Context ctxt, Cursor c,
                        ViewGroup parent) {
                LayoutInflater inflater = getLayoutInflater();
                View row = inflater.inflate(R.layout.release_row, parent, 
false);
                SDIReleaseWrapper wrapper = new SDIReleaseWrapper(row);
                row.setTag(wrapper);
                wrapper.populateFrom(c);

                return row;
        }

and the rows are populated with information from the database through
the wrapper. The TextViews in the rows show up fine, but the
ImageViews seem to have random effects.

I'm not really understanding the process of populating an ImageView in
the row or why the ImageView doesn't know which row to populate with
the image.

If someone could point me in the right direction that would be great.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to