Android listview显示来自internet的图像和来自sqlite的数据

Android listview显示来自internet的图像和来自sqlite的数据,android,listview,Android,Listview,我的游标从sqlite获取3列数据,第一列是配方名称,第二列是配方作者,第三列是配方图像的url。这是我代码的一部分 private static final String fields[] = { "recipeID", "recipeName", "thumbnail"}; Cursor mCursor = dbAdapter.getAllTitles(); //get all titles returns the recipe name, author and thumbs startMa

我的游标从sqlite获取3列数据,第一列是配方名称,第二列是配方作者,第三列是配方图像的url。这是我代码的一部分

private static final String fields[] = { "recipeID", "recipeName", "thumbnail"};
Cursor mCursor = dbAdapter.getAllTitles(); //get all titles returns the recipe name, author and thumbs
startManagingCursor(mCursor);
dataSource = new SimpleCursorAdapter(this, R.layout.recipelist, mCursor, fields,    
                  new int[] { R.id.recipeAuthor, R.id.recipeName, R.id.recipeThumb });
setListAdapter(dataSource);

显然,上面的代码没有显示配方图像,而是在R.id.recipeThumb处显示配方图像的url。如何使其显示来自internet的图片

本次讨论答案下方的帖子可能对您有用:


您需要一个CustomAdapter并重写getView()方法。 在基于Url的getView()方法中,创建ImageView

getView(...) {
   //First Create a Drawable from the InputStream of the Url 
   //store this drawable locally so that you don't have to fetch it again 
   Drawable imgDrawable = Drawable.createFromStream(inputStream,"");
   //set this in the imageView
   imgView.setImageDrawable(imgDrawable);

   //set this imgView in the contentview and return

}

事实上,我以前也看过lazylist的帖子,但是没有时间修改它以适应我的问题。。但是我想我应该花更多的时间看看它