title: How to get current location on google mapview in android
body: <p>In this my code i did not understand where i did mistake in my code .I did not get current location on map view with pin point image. How to get the Latitude &amp; Latitude and pass in Geo point. then pass the value OverlayItem ..</p>
  
  <pre><code>public class HelloGoogleMaps2 extends MapActivity implements LocationListener{
  
   private LocationManager locationManager;
   private String provider;
   int lat;
   int lng;
   MyLocationOverlay  myLocOverlay;
  @Override
  public void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.main);
  
      MapView mapView = (MapView) findViewById(R.id.mapview);    
      mapView.setBuiltInZoomControls(true);
  
      // Get the location manager
      locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
      // Define the criteria how to select the locatioin provider -&gt; use
      // default
      Criteria criteria = new Criteria();
      provider = locationManager.getBestProvider(criteria, true);
      Location location = locationManager.getLastKnownLocation(provider);
  
      Log.d("provider  ","Provider  "+provider);
      Log.d("provider  ","Provider  "+provider);
      Log.d("provider  ","Provider  "+provider);
      Log.d("location","Location "+location);
  
      Log.d("location","Location "+location);        
  
      Log.d("location","Location "+location);
      // Initialize the location fields
      if (location != null) {
        System.out.println("Provider " + provider + " has been selected.");
        onLocationChanged(location);
      } else {
        //latituteField.setText("Location not available");
       // longitudeField.setText("Location not available");
      }
  
  
      List&lt;Overlay&gt; mapOverlays = mapView.getOverlays();
  
      myLocOverlay = new MyLocationOverlay(this, mapView);
      mapOverlays.add(myLocOverlay);
      myLocOverlay.enableMyLocation();
      GeoPoint point = new GeoPoint(lat, lng);
     //        mc.setCenter(point);
      //        mapView.invalidate();
  
      Drawable drawable = this.getResources().getDrawable(R.drawable.ic_launcher);
      HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable);
  
        GeoPoint point = new GeoPoint(lat,lng);
  OverlayItem overlayitem = new OverlayItem(point, "Hola, Mundo!", "I'm in Mexico City!");
  
  
  itemizedoverlay.addOverlay(overlayitem);
  mapOverlays.add(itemizedoverlay);
  }
  
  
  @Override
  protected boolean isRouteDisplayed() {
      // TODO Auto-generated method stub
      return false;
  }
  
   protected void onResume() {
          super.onResume();
          locationManager.requestLocationUpdates(provider, 400, 1, this);
        }
  
        /* Remove the locationlistener updates when Activity is paused */
        //
        protected void onPause() {
          super.onPause();
          locationManager.removeUpdates(this);
        }
  
        //
        public void onLocationChanged(Location location) {
           lat = (int) (location.getLatitude()* 1E6);
           lng = (int) (location.getLongitude()* 1E6);
         // latituteField.setText(String.valueOf(lat));
         // longitudeField.setText(String.valueOf(lng));
        }
  
        //
        public void onStatusChanged(String provider, int status, Bundle extras) {
          // TODO Auto-generated method stub
  
        }
  
        //
        public void onProviderEnabled(String provider) {
          Toast.makeText(this, "Enabled new provider " + provider,
              Toast.LENGTH_SHORT).show();
  
        }
  
        //
        public void onProviderDisabled(String provider) {
          Toast.makeText(this, "Disabled provider " + provider,
              Toast.LENGTH_SHORT).show();
        }
  </code></pre>
  
  <p>}</p>