title: How to get My Location changed event with Google Maps android API v2?
body: <p>How to get My Location changed event with <a href="https://developers.google.com/maps/documentation/android/" rel="noreferrer">Google Maps android API <strong>v2</strong></a>?</p>
  
  <p>In <strong>v1</strong> you can do the next in order to handle location changed event:</p>
  
  <pre><code>public class MyLocationOverlay extends com.google.android.maps.MyLocationOverlay {
  
      /**
       * Listener
       */
      public interface Listener {
          void onLocationChanged(android.location.Location location);
      }
  
      private Listener listener;
  
      public MyLocationOverlay(Context context, MapView mapView, Listener listener) {
          super(context, mapView);
  
          this.listener = listener;
      }
  
      @Override
      public synchronized void onLocationChanged(Location location) {
          super.onLocationChanged(location);
  
          // fire listener
          if (listener != null)
              listener.onLocationChanged(location);
      }
  }
  </code></pre>