30 |
} |
} |
31 |
|
|
32 |
@Override |
@Override |
33 |
public void lookupStations(Location location) { |
public boolean lookupStations(Location location) { |
34 |
|
boolean success = false; |
35 |
String url = "http://app.t-hoerup.dk/TrainInfoService/LocateStations?latitude=" + location.getLatitude() + "&longitude=" + location.getLongitude(); |
String url = "http://app.t-hoerup.dk/TrainInfoService/LocateStations?latitude=" + location.getLatitude() + "&longitude=" + location.getLongitude(); |
36 |
Log.i("url", url); |
Log.i("url", url); |
37 |
try { |
try { |
83 |
|
|
84 |
} |
} |
85 |
stations.add(station); |
stations.add(station); |
86 |
} |
} |
87 |
|
success = true; |
88 |
|
|
89 |
|
|
90 |
} catch (Exception e) { |
} catch (Exception e) { |
91 |
Log.e("XmlStationProvider", "lookupStations: ", e); |
Log.e("XmlStationProvider", "lookupStations: ", e); |
92 |
} |
} |
93 |
|
return success; |
94 |
} |
} |
95 |
|
|
96 |
public Document parseXML(String str) throws SAXException, IOException, ParserConfigurationException |
private Document parseXML(String str) throws SAXException, IOException, ParserConfigurationException |
97 |
{ |
{ |
98 |
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); |
DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder(); |
99 |
return builder.parse( new ByteArrayInputStream(str.getBytes()) ); |
return builder.parse( new ByteArrayInputStream(str.getBytes()) ); |