I am developing an app that downloads an XML file, parses it and then displays the information on the screen. I get a NullPointerException
Exception error in the following code:
here is the code:
private class DownloadXmlTask extends AsyncTask<String, Void, List<vehicleInfo>> {
@Override
protected List<vehicleInfo> doInBackground(String... url) {
try {
return getvehicles.processBusTime();
} catch (IOException e) {
return null;
} catch (XmlPullParserException e) {
return null;
}
}
@Override
protected void onPostExecute(List<vehicleInfo> result) {
for (int record = 0; record < result.size(); record++) {
double latitude = result.get(record).latitude;
double longitude = result.get(record).longitude;
mMap.addMarker(new MarkerOptions().position(new LatLng(latitude, longitude)).title("Marker"));
}
}
}
it is returns a NullPointerException
at the line: for (int record = 0; record < result.size(); record++) {
what could be the issue?
thanks.