Reputation: 191
I am trying yo override Google map's default my location button to display "GPS is not enabled" message if the user is pressing the mylocation button when gps is not enabled. How can i do this?
Upvotes: 2
Views: 4480
Reputation: 2633
i can add the code based on Hoan Answer
map.setOnMyLocationButtonClickListener(new GoogleMap.OnMyLocationButtonClickListener() {
@Override
public boolean onMyLocationButtonClick() {
Toast.makeText(getActivity(), "Good", Toast.LENGTH_SHORT).show();
return false;
}
});
you can make what you want in the function
Upvotes: 0
Reputation: 18151
register for the mylocation click using setOnMyLocationButtonClickListener
and in onMyLocationButtonClick ()
show your message.
Upvotes: 6