I had this working, made a change somewhere and now I can’t track down the error.
Here’s the situation… when _regionList creates, there are 13 regions in the xml file for the region I am using but the _regionlist/children/array has 18 objects. Using a different region (50 elements) it creates with 60 objects.
The remaining objects in the array have a null ID of course, which is the problem. Any thoughts on how additional objects are getting thrown in there?
Thanks
// Parse XML file
public void Parse(InputStream inStream, String inRegion)
{
try {
String _region = inRegion;
this.cFactory = DocumentBuilderFactory.newInstance();
this.cBuilder = this.cFactory.newDocumentBuilder();
this.cBuilder.isValidating();
Document _document = this.cBuilder.parse(inStream, null);
_document.getDocumentElement().normalize();
NodeList _regionList = _document.getElementsByTagName(_region);
final int _length = _regionList.getLength();
for (int i = 0; i < _length; i++) {
final NamedNodeMap _attr = _regionList.item(i).getAttributes();
final String _regionName = GetNodeValue(_attr, "name");
// Construct a Region object
PropertiesRegion _regionObject = new PropertiesRegion(_regionName);
// Add to list
this.cList.add(_regionObject);
Log.d(TAG, _regionObject.toString());
}
}
catch (SAXException e)
{
e.printStackTrace();
}
catch (IOException e)
{
e.printStackTrace();
}
catch (ParserConfigurationException e)
{
e.printStackTrace();
}
}
Additional null indexes in an ArrayList (collection) are fine. The problem is in the TextView and wiring it to the ArrayList.