Show marker on google map position obtained from xml
<p>I want to show a marker on google map position obtained from xml after parsing. So I store latitude and longitude in an arrylist. I want to show but it forse close</p>

<p>I pass lat and long from geopoint so please can you take a look where is wrong in my code </p>

<pre><code>public class XMLParsingExample1 extends MapActivity {
    /**
     * Create Object For SiteList Class
     */
    SitesList sitesList = null;
    private MapController mapController;
    private MapView mapView;
    private LocationManager locationManager;
    private String ss1;
    private String ss2;
    GeoPoint p;

    class MapOverlay extends com.google.android.maps.Overlay {
        @Override
        public boolean draw(Canvas canvas, MapView mapView,
                            boolean shadow, long when) {
            super.draw(canvas, mapView, shadow);

            //---translate the GeoPoint to screen pixels---
            Point screenPts = new Point();
            mapView.getProjection().toPixels(p, screenPts);

            //---add the marker---
            Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.marker);
            canvas.drawBitmap(bmp, screenPts.x, screenPts.y - 50, null);
            return true;
        }
    }

    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        /** Create a new layout to display the view */


        try {

            /** Handling XML */
            SAXParserFactory spf = SAXParserFactory.newInstance();
            SAXParser sp = spf.newSAXParser();
            XMLReader xr = sp.getXMLReader();

            /** Send URL to parse XML Tags */
            URL sourceUrl = new URL(
                    "http://site4demo.com/artealdiaonline/output.php?lat=-34.6394879&amp;lng=-58.3617837kkj");

            /** Create handler to handle XML Tags ( extends DefaultHandler ) */
            MyXMLHandler myXMLHandler = new MyXMLHandler();
            xr.setContentHandler(myXMLHandler);
            xr.parse(new InputSource(sourceUrl.openStream()));

        } catch (Exception e) {
            System.out.println("XML Pasing Excpetion = " + e);
        }

        /** Get result from MyXMLHandler SitlesList Object */
        sitesList = MyXMLHandler.sitesList;

        ArrayList&lt;Integer&gt; Latitude = new ArrayList&lt;Integer&gt;();
        ArrayList&lt;Integer&gt; Longtitude = new ArrayList&lt;Integer&gt;();
        for (int i = 0; i &lt; sitesList.getName().size(); i++) {

        // **Is this correct??**
            ss1 = sitesList.getName().get(i);

        }
        for (int i = 0; i &lt; sitesList.getWebsite().size(); i++) {
            ss2 = sitesList.getWebsite().get(i);
        }


        RelativeLayout linearLayout = (RelativeLayout) findViewById(R.id.mainlayout);
        mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
        //mapView.setStreetView(true);
        mapView.setSatellite(true);
        mapController = mapView.getController();
        mapController.setZoom(14); // Zoon 1 is world view
        locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0,
                0, new GeoUpdateHandler());

        //Here i pass latitude and longitude value for displaying in map

        String coordinates[] = {ss1, ss2};
        double lat = Double.parseDouble(coordinates[0]);
        double lng = Double.parseDouble(coordinates[1]);
        p = new GeoPoint(
                (int) (lat * 1E6),
                (int) (lng * 1E6));

        mapController.animateTo(p);
        mapController.setZoom(17);

        //---Add a location marker---
        MapOverlay mapOverlay = new MapOverlay();
        List&lt;Overlay&gt; listOfOverlays = mapView.getOverlays();
        listOfOverlays.clear();
        listOfOverlays.add(mapOverlay);
        mapView.invalidate();
    }

    @Override
    protected boolean isRouteDisplayed() {
        return false;
    }

    public class GeoUpdateHandler implements LocationListener {
        @Override
        public void onLocationChanged(Location location) {
            int lat = (int) (location.getLatitude() * 1E6);
            int lng = (int) (location.getLongitude() * 1E6);
            GeoPoint point = new GeoPoint(lat, lng);
            mapController.animateTo(point); //  mapController.setCenter(point);
        }

        @Override
        public void onProviderDisabled(String provider) {
        }

        @Override
        public void onProviderEnabled(String provider) {
        }

        @Override
        public void onStatusChanged(String provider, int status, Bundle extras) {
        }
    }
}
</code></pre>

<p>sites list is</p>

<p>public class SitesList {</p>

<pre><code>/** Variables */
private ArrayList&lt;String&gt; Latitude = new ArrayList&lt;String&gt;();
private ArrayList&lt;String&gt; Longitude = new ArrayList&lt;String&gt;();
private ArrayList&lt;String&gt; category = new ArrayList&lt;String&gt;();


/** In Setter method default it will return arraylist 
 *  change that to add  */

public ArrayList&lt;String&gt; getName() {
    return Latitude;
}

public void setName(String name) {
    this.Latitude.add(name);
}

public ArrayList&lt;String&gt; getWebsite() {
    return Longitude;
}

public void setWebsite(String website) {
    this.Longitude.add(website);
}

public ArrayList&lt;String&gt; getCategory() {
    return category;
}

public void setCategory(String category) {
    this.category.add(category);
}
</code></pre>

<p>}</p>
