Hey Hi,
In the following code the only problem is coming when I uncomment the //double src_lat =location.getLatitude(); and //double src_long =location.getLongitude(); lines , if I fix them using coordinates then I get the map , but when I try to find it using the location object then I get a message saying your application has stopped responding .
I hope I am properly posting the question , anyways I had also posted the log cat data which I get below .
Code:
package com.goolge;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.util.List;
import java.util.Locale;

import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;

import org.w3c.dom.Document;
import org.xml.sax.SAXException;

import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapView;
import android.location.Geocoder;

import android.content.Context;
import android.graphics.Color;
import android.location.Address;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.os.Bundle;
import android.util.Log;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.Toast;

public class RoutePath extends MapActivity {
    /** Called when the activity is first created. */

    MapView mapView;
    LocationManager locationManager;
    Button search;
    String destination;
    TextView destinationTextView;
    EditText destinationEditText;
    Geocoder myGeocoder;
    Address addr;
    List<Address> address;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        search=(Button)findViewById(R.id.findButton);
        destinationTextView=(TextView)findViewById(R.id.destinationTextView);
        destinationEditText=(EditText)findViewById(R.id.destinationEditText);
        destination = destinationEditText.getText().toString();
        addr=new Address(Locale.getDefault());
        myGeocoder=new Geocoder(getBaseContext());
        destination=new String();
        MapView mapView = (MapView) findViewById(R.id.myMapView1);
        try {
            //address = myGeocoder.getFromLocation(28.58, 77.33, 1);
            address=myGeocoder.getFromLocationName(destination,1);//has to work to find longitude and lattitude of destination
        } catch (IOException e1) {
            // TODO Auto-generated catch block
            e1.printStackTrace();
        }
        
      
        LocationManager locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
        LocationListener ll = new mylocationlistener();
        Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
        locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 0, 0, ll);
        addr=address.get(0);
        //double src_lat  =location.getLatitude();
        //double src_long =location.getLongitude();
        //double dest_lat = 77.23;
        //double dest_long =36.45;
        
        double src_lat =28.58; 
        double src_long =77.33; 
        double dest_lat = 28.47;
        double dest_long =77.01; 
        GeoPoint srcGeoPoint = new GeoPoint((int) (src_lat * 1E6),
                (int) (src_long * 1E6));
        GeoPoint destGeoPoint = new GeoPoint((int) (dest_lat * 1E6),
                (int) (dest_long * 1E6));

        DrawPath(srcGeoPoint, destGeoPoint, Color.GREEN, mapView);

        mapView.getController().animateTo(srcGeoPoint);
        mapView.getController().setZoom(15);

    }
    private class mylocationlistener implements LocationListener {
        @Override
        public void onLocationChanged(Location location) {
            if (location != null) {
            Log.d("LOCATION CHANGED", location.getLatitude() + "");
            Log.d("LOCATION CHANGED", location.getLongitude() + "");
            Toast.makeText(RoutePath.this,
                location.getLatitude() + "" + location.getLongitude(),
                Toast.LENGTH_LONG).show();
            }
        }
        @Override
        public void onProviderDisabled(String provider) {
        }
        @Override
        public void onProviderEnabled(String provider) {
        }
        @Override
        public void onStatusChanged(String provider, int status, Bundle extras) {
        }
        }
    

    @Override
    protected boolean isRouteDisplayed() {
        // TODO Auto-generated method stub
        return false;
    }

    private void DrawPath(GeoPoint src, GeoPoint dest, int color,
            MapView mMapView01) {

        // connect to map web service
        StringBuilder urlString = new StringBuilder();
        urlString.append("http://maps.google.com/maps?f=d&hl=en");
        urlString.append("&saddr=");// from
        urlString.append(Double.toString((double) src.getLatitudeE6() / 1.0E6));
        urlString.append(",");
        urlString
                .append(Double.toString((double) src.getLongitudeE6() / 1.0E6));
        urlString.append("&daddr=");// to
        urlString
                .append(Double.toString((double) dest.getLatitudeE6() / 1.0E6));
        urlString.append(",");
        urlString.append(Double
                .toString((double) dest.getLongitudeE6() / 1.0E6));
        urlString.append("&ie=UTF8&0&om=0&output=kml");

        Log.d("xxx", "URL=" + urlString.toString());

        // get the kml (XML) doc. And parse it to get the coordinates(direction
        // route).
        Document doc = null;
        HttpURLConnection urlConnection = null;
        URL url = null;
        try {
            url = new URL(urlString.toString());
            urlConnection = (HttpURLConnection) url.openConnection();
            urlConnection.setRequestMethod("GET");
            urlConnection.setDoOutput(true);
            urlConnection.setDoInput(true);
            urlConnection.connect();

            DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
            DocumentBuilder db = dbf.newDocumentBuilder();
            doc = db.parse(urlConnection.getInputStream());

            if (doc.getElementsByTagName("GeometryCollection").getLength() > 0) {

                // String path =
                // doc.getElementsByTagName("GeometryCollection").item(0).getFirstChild().getFirstChild().getNodeName();
                String path = doc.getElementsByTagName("GeometryCollection")
                        .item(0).getFirstChild().getFirstChild()
                        .getFirstChild().getNodeValue();

                Log.d("xxx", "path=" + path);

                String[] pairs = path.split(" ");
                String[] lngLat = pairs[0].split(","); // lngLat[0]=longitude
                                                        // lngLat[1]=latitude
                                                        // lngLat[2]=height

                // src
                GeoPoint startGP = new GeoPoint((int) (Double
                        .parseDouble(lngLat[1]) * 1E6), (int) (Double
                        .parseDouble(lngLat[0]) * 1E6));
                mMapView01.getOverlays()
                        .add(new MyOverLay(startGP, startGP, 1));

                GeoPoint gp1;
                GeoPoint gp2 = startGP;
                for (int i = 1; i < pairs.length; i++) // the last one would be
                                                        // crash
                {
                    lngLat = pairs[i].split(",");
                    gp1 = gp2;
                    // watch out! For GeoPoint, first:latitude, second:longitude
                    gp2 = new GeoPoint(
                            (int) (Double.parseDouble(lngLat[1]) * 1E6),
                            (int) (Double.parseDouble(lngLat[0]) * 1E6));
                    mMapView01.getOverlays().add(
                            new MyOverLay(gp1, gp2, 2, color));

                    Log.d("xxx", "pair:" + pairs[i]);

                }
                mMapView01.getOverlays().add(new MyOverLay(dest, dest, 3)); // use
                                                                            // the
                                                                            // default
                                                                            // color
            }
        } catch (MalformedURLException e) {

            e.printStackTrace();
        } catch (IOException e) {

            e.printStackTrace();
        } catch (ParserConfigurationException e) {

            e.printStackTrace();

        } catch (SAXException e) {

            e.printStackTrace();
        }

    }

}

07-10 19:31:07.065: I/dalvikvm(2160): threadid=3: reacting to signal 3
07-10 19:31:07.135: I/dalvikvm(2160): Wrote stack traces to '/data/anr/traces.txt'
07-10 19:31:07.245: I/dalvikvm(2160): threadid=3: reacting to signal 3
07-10 19:31:07.355: I/dalvikvm(2160): Wrote stack traces to '/data/anr/traces.txt'
07-10 19:31:07.756: I/dalvikvm(2160): threadid=3: reacting to signal 3
07-10 19:31:08.026: D/dalvikvm(2160): GC_CONCURRENT freed 167K, 3% free 9305K/9543K, paused 8ms+5ms
07-10 19:31:08.026: W/CursorWrapperInner(2160): Cursor finalized without prior close()
07-10 19:31:08.026: W/CursorWrapperInner(2160): Cursor finalized without prior close()
07-10 19:31:08.080: I/dalvikvm(2160): Wrote stack traces to '/data/anr/traces.txt'
07-10 19:31:08.275: I/dalvikvm(2160): threadid=3: reacting to signal 3
07-10 19:31:08.295: I/dalvikvm(2160): Wrote stack traces to '/data/anr/traces.txt'
07-10 19:31:08.786: I/dalvikvm(2160): threadid=3: reacting to signal 3
07-10 19:31:08.806: I/dalvikvm(2160): Wrote stack traces to '/data/anr/traces.txt'
07-10 19:31:09.055: D/AndroidRuntime(2160): Shutting down VM
07-10 19:31:09.065: W/dalvikvm(2160): threadid=1: thread exiting with uncaught exception (group=0x409c01f8)
07-10 19:31:09.095: E/AndroidRuntime(2160): FATAL EXCEPTION: main
07-10 19:31:09.095: E/AndroidRuntime(2160): java.lang.RuntimeException: Unable to start activity ComponentInfo{com.goolge/com.goolge.RoutePath}: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
07-10 19:31:09.095: E/AndroidRuntime(2160): at android.app.ActivityThread.performLaunchActivity(A ctivityThread.java:1956)
07-10 19:31:09.095: E/AndroidRuntime(2160): at android.app.ActivityThread.handleLaunchActivity(Ac tivityThread.java:1981)
07-10 19:31:09.095: E/AndroidRuntime(2160): at android.app.ActivityThread.access$600(ActivityThre ad.java:123)
07-10 19:31:09.095: E/AndroidRuntime(2160): at android.app.ActivityThread$H.handleMessage(Activit yThread.java:1147)
07-10 19:31:09.095: E/AndroidRuntime(2160): at android.os.Handler.dispatchMessage(Handler.java:99 )
07-10 19:31:09.095: E/AndroidRuntime(2160): at android.os.Looper.loop(Looper.java:137)
07-10 19:31:09.095: E/AndroidRuntime(2160): at android.app.ActivityThread.main(ActivityThread.jav a:4424)
07-10 19:31:09.095: E/AndroidRuntime(2160): at java.lang.reflect.Method.invokeNative(Native Method)
07-10 19:31:09.095: E/AndroidRuntime(2160): at java.lang.reflect.Method.invoke(Method.java:511)
07-10 19:31:09.095: E/AndroidRuntime(2160): at com.android.internal.os.ZygoteInit$MethodAndArgsCa ller.run(ZygoteInit.java:784)
07-10 19:31:09.095: E/AndroidRuntime(2160): at com.android.internal.os.ZygoteInit.main(ZygoteInit .java:551)
07-10 19:31:09.095: E/AndroidRuntime(2160): at dalvik.system.NativeStart.main(Native Method)
07-10 19:31:09.095: E/AndroidRuntime(2160): Caused by: java.lang.IndexOutOfBoundsException: Invalid index 0, size is 0
07-10 19:31:09.095: E/AndroidRuntime(2160): at java.util.ArrayList.throwIndexOutOfBoundsException (ArrayList.java:251)
07-10 19:31:09.095: E/AndroidRuntime(2160): at java.util.ArrayList.get(ArrayList.java:304)
07-10 19:31:09.095: E/AndroidRuntime(2160): at com.goolge.RoutePath.onCreate(RoutePath.java:81)
07-10 19:31:09.095: E/AndroidRuntime(2160): at android.app.Activity.performCreate(Activity.java:4 465)
07-10 19:31:09.095: E/AndroidRuntime(2160): at android.app.Instrumentation.callActivityOnCreate(I nstrumentation.java:1049)
07-10 19:31:09.095: E/AndroidRuntime(2160): at android.app.ActivityThread.performLaunchActivity(A ctivityThread.java:1920)
07-10 19:31:09.095: E/AndroidRuntime(2160): ... 11 more
07-10 19:31:09.425: I/dalvikvm(2160): threadid=3: reacting to signal 3
07-10 19:31:09.465: I/dalvikvm(2160): Wrote stack traces to '/data/anr/traces.txt'
07-10 19:31:09.726: I/dalvikvm(2160): threadid=3: reacting to signal 3
07-10 19:31:09.756: I/dalvikvm(2160): Wrote stack traces to '/data/anr/traces.txt'
07-10 19:31:12.796: I/Process(2160): Sending signal. PID: 2160 SIG: 9