How to get Current Location through GPS in Android
<p>I am developing application based on google maps in that current location of user has to display in map. i have google it and find solution but when i run the code it doesnt shows the current location instead it showing google map alone. My code is below</p>

<pre><code> public class GPSLocation extends MapActivity {
private MapView mapView;
private MapController mapController;
private LocationManager locationManager;
private GPSLocationListener locationListener;

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

    // enable Street view by default
   // mapView.setStreetView(true);

    // enable to show Satellite view
    // mapView.setSatellite(true);

    // enable to show Traffic on map
    // mapView.setTraffic(true);

  //  mapView.setBuiltInZoomControls(true);

  //  mapController = mapView.getController();
   // mapController.setZoom(16);




    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);  

    locationListener = new GPSLocationListener();

    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER,0,0,locationListener);


}
private class GPSLocationListener implements LocationListener 
{
    public GPSLocationListener() {
        // TODO Auto-generated constructor stub
    }
  @Override
  public void onLocationChanged(Location location) {
    if (location != null) {
        System.out.println("onLocationChanged");
          GeoPoint point = new GeoPoint(
                  (int) (location.getLatitude() * 1E6), 
                  (int) (location.getLongitude() * 1E6));


      Toast.makeText(getBaseContext(), 
          "Latitude: " + location.getLatitude() + 
          " Longitude: " + location.getLongitude(), 
          Toast.LENGTH_SHORT).show();

      mapController.animateTo(point);
      mapController.setZoom(16);
      mapView.invalidate();
    }
    else
    {
        System.out.println("OnLocationChanged value is null");
    }
  }



@Override
public void onProviderDisabled(String arg0) {
    // TODO Auto-generated method stub

}


@Override
public void onProviderEnabled(String arg0) {
    // TODO Auto-generated method stub

}


@Override
public void onStatusChanged(String arg0, int arg1, Bundle arg2) {
    // TODO Auto-generated method stub

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





}
</code></pre>

<p>I dont know where i have done mistake.Its not even entering into GPSLocationListener class. please help me..
Thanks in advance.</p>
