开发者

want to show images in listview after reading their path from xml file

开发者 https://www.devze.com 2023-02-27 01:14 出处:网络
I showing list in android list view, I am reading image name and I have on the web but now I want to show respective image with each list item.

I showing list in android list view, I am reading image name and I have on the web but now I want to show respective image with each list item.

Following is the code.

NodeList nodes = doc.getElementsByTagName("product");

for (int i = 0; i < nodes.getLength(); i++) {                           
    HashMap<String, String> map = new HashMap<String, String>();    

    Element e = (Element)nodes.item(i);
    map.put("id", GetXML.getValue(e, "id"));
    //map.put("ProductName", "Product Name开发者_JAVA百科:" + GetXML.getValue(e, "ProductName")); Example
    map.put("ProductName", GetXML.getValue(e, "ProductName"));
    map.put("Desc",  GetXML.getValue(e, "Desc"));
    map.put("Price", GetXML.getValue(e, "Price"));
    map.put("ImagePath", GetXML.getValue(e, "ImagePath"));
    mylist.add(map);            
}       

ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.lbsdetailitems, 
                new String[] { "ProductName", "Desc","Price","ImagePath" }, 
                new int[] { R.id.product_name, R.id.desc , R.id.price,R.id.image});

setListAdapter(adapter);

final ListView lv = getListView();
lv.setTextFilterEnabled(true);

I tried to understand lazy list but i do not know how can load image in this scenario. I need help to show images in list view.

Thanks,

Beeedoo

0

精彩评论

暂无评论...
验证码 换一张
取 消