public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.offers);
ArrayList<HashMap<String, String>> mylist = new ArrayList<HashMap<String, String>>();
String xml = XMLfunctions.getX## Heading ##ML();
Document doc = XMLfunctions.XMLfromString(xml);
int numResults = XMLfunctions.numResults(doc);
if((numResults <= 0))
{
Toast.makeText(OffersActivity.this, "Geen resultaten gevonden", Toast.LENGTH_LONG).show();
finish();
}
ImageView newImg = (ImageView) findViewById(R.id.thumbimage);
NodeList nodes = doc.getElementsByTagName("result");
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", XMLfunctions.getValue(e, "id"));
map.put("name", "" + XMLfunctions.getValue(e, "name"));
map.put("Score", "" + XMLfunctions.getValue(e, "score"));
map.put("thumbnail", "" + XMLfunctions.getValue(e, "thumbimg"));
mylist.add(map);
}
ListAdapter adapter = new SimpleAdapter(this, mylist , R.layout.listitems,
new String[] { "name", "Score", "thumbnail"},
new int[] { R.id.item_title, R.id.item_subtitle, R.id.thumbimage });
setListAdapter(adapter);
}
我有要显示的图像的地址
map.put("thumbnail", "" + XMLfunctions.getValue(e, "thumbimg"));
我也得到了它们。实际上它们来自实时xml。我想把它们放在图像视图中。请帮忙!
谢谢