julius wrote:
> 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);
You could use iv.setImageURI(Uri.fromFile(...)).
> However when I scroll and the images are loaded they seem to turn up
> in the wrong places.
Are you doing the image loading in the main application thread, or a
background thread (e.g., AsyncTask)?
If you are using a background thread, bear in mind that you may have
scrolled before the image gets put into the list.
> 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.
Are you sure your SDIReleaseWrapper is pointing to the right ImageView?
Is your above bitmap-loading code part of populateFrom()?
--
Mark Murphy (a Commons Guy)
http://commonsware.com | http://github.com/commonsguy
http://commonsware.com/blog | http://twitter.com/commonsguy
Android Development Wiki: http://wiki.andmob.org
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en