I want to set imagese in listview but I don't do it properly. What's wrong with images I dont know .plz help me my code is here.
final ArrayList<HashMap<String,String>> dataListfeture = new ArrayList<HashMap<String,String>>();
ArrayList<HashMap<String,String>> dataList = new ArrayList<HashMap<String,String>>();
for(int j=0; j<nodesfeture.getLength(); j++)
{
开发者_如何学运维 Element e1 =(Element)nodesfeture.item(j);
Node node = nodesfeture.item(j);
HashMap<String, String> mapfeautre = new HashMap<String, String>();
mapfeautre.put("name",node.getAttributes().getNamedItem("name").getNodeValue());
String rename = mapfeautre.put("name",node.getAttributes().getNamedItem("name").getNodeValue());
rename.replaceAll("", "%20");
mapnamelist= mapfeautre.put("name",node.getAttributes().getNamedItem("name").getNodeValue());
mapfeautre.put("distance",node.getAttributes().getNamedItem("distance").getNodeValue());
mapdistancelist =mapfeautre.put("distance",node.getAttributes().getNamedItem("distance").getNodeValue());
mapfeautre.put("venuetype",node.getAttributes().getNamedItem("venuetype").getNodeValue());
mapvenuelist=mapfeautre.put("venuetype",node.getAttributes().getNamedItem("venuetype").getNodeValue());
mapfeautre.put("imageupload",node.getAttributes().getNamedItem("imageupload").getNodeValue());
String strimageurl=mapfeautre.put("imageupload",node.getAttributes().getNamedItem("imageupload").getNodeValue());
mapimagelist="http://www.afterdarknightlife.com/"+strimageurl;
System.out.println("Image URL "+j+" :"+mapimagelist);
mylistfeature.add(mapfeautre);
}
System.out.println("data list = "+dataListfeture);
ListAdapter adapterfeaturetype = new SimpleAdapter(MainScreen.this, mylistfeature, R.layout.demophoto, new String[]
{
"imageupload","name", "distance","venuetype
},
new int[]
{
R.id.item_featureimage,
R.id.item_featurename,
R.id.item_featuredistance,
R.id.item_featurevenuetype,
});
may be this will help you...
http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/List14.html
Please give GreedDroid a try. It has very advanced set of list view items (including an item with an image) which you can use from code and from xml as well.
精彩评论