I want to generate geopoints after parsing XML using SAX Parser
I am able to parse XML using SAX Parser and able to display the points in text view. But now I want the points to be displayed on the map.The XML Contains tags for latitude and longitude. I want to read the latitiudes and longitudes and display them on map.
UPDATE:
public void parsing()
{
try
{
SAXParserFactory spf = SAXParserFactory.newInstance();
SAXParser sp = spf.newSAXParser();
XMLReader xr = sp.getXMLReader();
XMLHandler handler = new XMLHandler();
xr.setContentHandler(handler);
InputStream in=this.getResources().openRawResource(R.raw.poi);
xr.parse(new InputSource(in));
}
catch(Exception e)
{
System.out.println("XML Parsing Excpetion = " + e);
}
poilist=XMLHandler.POIList;
ArrayList<Integer&g开发者_开发问答t; Latitude=new ArrayList<Integer>();
ArrayList<Integer> Longtitude=new ArrayList<Integer>();
for(int i=0;i<poilist.getlat().size();i++)
{
Latitude.add(i);
Longtitude.add(i);
}
}
Now I want to pass these latitude and longitude values to the Geopoint.. Any suggestions??
GeoPoint point = new GeoPoint(lat, lng);
The above line of code will give you a GeoPoint object with the latitude and longitude you pass to the constructor. GeoPoint belongs to the Google Maps API add-on. After you create the GeoPoint, you add it to a map overlay on the MapView.
You should check out Google's explination and example of doing this. http://developer.android.com/resources/tutorials/views/hello-mapview.html
精彩评论