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 .
+1
A:
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
Jason Knight
2010-10-05 07:49:02
Thanks Jason...
shaireen
2010-10-05 09:08:29
But i have one more problem .I have read XMl and stored the result in array list and used GeoPoint point = new GeoPoint(lat, lng); ... But after parsing XML ,i have stored values in array list,but somehow i am not able to use the array list with GeoPoint...Do u have any clue about this??
shaireen
2010-10-05 09:10:58
I would have to see the code to understand what you're trying to do.
Jason Knight
2010-10-05 09:16:15
A:
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> 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??
shaireen
2010-10-06 03:37:10