I'm having problems to implement an acynchronous image loader to the following code. I read some posts arround the web about it and I think I understand the logic behind it, but I seem to fail in implementing it.
The code bellow is what I use to simply load the images in my listview.
public class MyCustomAdapter extends ArrayAdapter<RSSItem> {
Bitmap bm;
public MyCustomAdapter(Context context, int textViewResourceId, List<RSSItem> list) {
super(context, textViewResourceId, list);
}
@Override
public View getView(int position, View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
BitmapFactory.Options bmOptions;
bmOptions = new BitmapFactory.Options();
bmOptions.inSampleSize = 1;
bm = LoadImage(myRssFeed.getList().get(position).getDescription(), bmOptions);
View row = convertView;
if(row == null) {
LayoutInflater inflater = getLayoutInflater();
row = inflater.inflate(R.layout.rsslist, parent, false);
}
TextView listTitle = (TextView)row.findViewById(R.id.listtitle);
listTitle.setText(myRssFeed.getList().get(position).getTitle());
ImageView listDescription = (ImageView)row.findViewById(R.id.listdescription);
listDescription.setImageBitmap(bm);
TextView listPubdate = (TextView)row.findViewById(R.id.listpubdate);
listPubdate.setText(myRssFeed.getList().get(position).getPubdate());
return row;
}
}