I enabled the my-location layer of the Google Maps Android API v2, which adds the floating button to go to the user's current location. I need a way to detect a click on this button. Is this possible?
Since this question was posted, Google has updated the API. They have added an onMyLocationButtonClick() listener.
To add the listener:
//add location button click listener
map.setOnMyLocationButtonClickListener(new GoogleMap.OnMyLocationButtonClickListener(){
    @Override
    public boolean onMyLocationButtonClick()
    {
        //TODO: Any custom actions
        return false;
    }
});
Returning false will essentially call the super method. Returning true will not.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With