dataAdapter = new ArrayAdapter(getApplicationContext(), R.layout.lst_layout, R.id.lstLayout, exList);
lstView = (ListView) findViewById(R.id.listView);
lstView.setAdapter(dataAdapter);
exList is the ArayList of String arrays. How to populate ListView with it?
exList = new ArrayList<String[]>();
Edit starts here. It's in asynctask created here asdad asd asd asdasada sdada daasd asd ad asda dasd asd asda da dasdasd asdasd ad :
@Override
protected String doInBackground(String... urls) {
String[] temp = new String[4];
try {
InputStream stream = downloadUrl("http://www.tcmb.gov.tr/kurlar/today.xml");
try {
XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
factory.setNamespaceAware(true);
XmlPullParser xpp = factory.newPullParser();
xpp.setInput(new InputStreamReader(stream));
int eventType = xpp.getEventType();
int kontrol = 0;
while (eventType != XmlPullParser.END_DOCUMENT) {
if (eventType == XmlPullParser.START_TAG) {
if (xpp.getName().equals("Currency")) {
kontrol++;
//ExchangeRate exr = new ExchangeRate();
//exr.setCurrencyCode(xpp.getAttributeValue(null, "CurrencyCode"));
temp[0] = xpp.getAttributeValue(null, "CurrencyCode");
Log.d("deneme: ", xpp.getAttributeValue(null, "CurrencyCode"));
} else if (xpp.getName().equals("Isim") && xpp.next() == XmlPullParser.TEXT) {
kontrol++;
//ExchangeRate exr = exList.get(exList.size() - 1);
//exr.setCurrencyName(xpp.getText());
temp[1] = xpp.getText();
Log.d("deneme", xpp.getText());
} else if (xpp.getName().equals("ForexBuying") && xpp.next() == XmlPullParser.TEXT) {
kontrol++;
//ExchangeRate exr = exList.get(exList.size() - 1);
//exr.setForexBuying(Double.valueOf(xpp.getText()));
temp[2] = xpp.getText();
Log.d("deneme", xpp.getText());
}else if (xpp.getName().equals("ForexSelling") && xpp.next() == XmlPullParser.TEXT) {
kontrol++;
//ExchangeRate exr = exList.get(exList.size() - 1);
//exr.setForexBuying(Double.valueOf(xpp.getText()));
temp[3] = xpp.getText();
Log.d("deneme", xpp.getText());
}
if (kontrol == 4) {
exList.add(temp);
temp = new String[4];
kontrol=0;
}
}
eventType = xpp.next();
}
} catch (XmlPullParserException e) {
e.printStackTrace();
}
return "";
} catch (IOException e) {
return e.getMessage();
}
}