Drawing a line between 2 geopoints using Android 2.3
<p>i am trying to draw a line between 2 geopoints.  i am able to show to geopoints on the map.
Its working fine. but i am not able to draw a line between 2 points. program has no error but line is not getting displayed. can anyone tell me what i have to change.</p>

<pre><code>public class HelloMapView extends MapActivity {
/** Called when the activity is first created. */
 LinearLayout linearLayout;
MapView mapView; 
MapController mc;
GeoPoint p,p1;

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.a);             
        canvas.drawBitmap(bmp, screenPts.x, screenPts.y-50, null);  

        //Coordinates 2 

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

        //---add the marker---
        Bitmap bmp1 = BitmapFactory.decodeResource(
            getResources(), R.drawable.b);             
        canvas.drawBitmap(bmp1, screenPts1.x, screenPts1.y-50, null); 

        //----------- Start--------------//

        Projection projection = mapView.getProjection();
        Path path = new Path();

        Point from = new Point();
        Point to = new Point();
        projection.toPixels(p, from);
        projection.toPixels(p1, to);
        path.moveTo(from.x, from.y);
        path.lineTo(to.x, to.y);

        Paint mPaint = new Paint();
        mPaint.setStyle(Style.FILL);
        mPaint.setColor(0xFFFF0000);
        mPaint.setAntiAlias(true);
        canvas.drawPath(path,mPaint);
        super.draw(canvas, mapView, shadow);         


        return true;
    }
} 


@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.main);

    mapView = (MapView) findViewById(R.id.mapview);

    mapView.setBuiltInZoomControls(true);

    mapView = (MapView) findViewById(R.id.mapview);



    mapView.displayZoomControls(true);
    mc = mapView.getController();
    String coordinates[] = {"12.958998", "77.658998"};
    double lat = Double.parseDouble(coordinates[0]);
    double lng = Double.parseDouble(coordinates[1]);

    p = new GeoPoint(
        (int) (lat * 1E6), 
        (int) (lng * 1E6));


    String coordinates1[] = {"12.95967","77.64918"};
    double lat1 = Double.parseDouble(coordinates1[0]);
    double lng1 = Double.parseDouble(coordinates1[1]);

    p1 = new GeoPoint(
        (int) (lat1 * 1E6), 
        (int) (lng1 * 1E6));


    mc.animateTo(p);
    mc.animateTo(p1);
    mc.setZoom(16); 

  //---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;
}          

}
</code></pre>
