How to use MyLocation-Button at Google Map API V2

android, google-maps, google-maps-android-api-2

Solution

map.setOnMyLocationButtonClickListener(new OnMyLocationButtonClickListener() {
                @Override
                public boolean onMyLocationButtonClick() {
                    Toast.makeText(
                            getActivity(),
                            "Example de Message for Android",
                            Toast.LENGTH_SHORT).show();
                    return true;
                }
            });

Problem

I want to make that when click in MyLocation-Button show a Toast. I try this code: ``` public void setMyLocationLayerEnabled(View v) { Toast toast = Toast.makeText(getApplicationContext(), "Example de Message for Android", Toast.LENGTH_SHORT); toast.show(); } ``` But no work. I hope somebody of you can help me!

Original source