0

So I have a class called 'InterestingPoint' with variables 'Name', 'Coordinates'. I've created a list with interesting places and then I've added markers on the map like that:

for (InterestingPoint point:route.points_of_interest){
        mMap.addMarker(new MarkerOptions().position(point.Coordinates).title(point.Name));
    }

So the main question is can I get details of any marker when I click on it? When I click on marker I want to show description and picture of that place.

1 Answers1

2

First, you need to set OnMarkerClickListener in onCreate method.

map.setOnMarkerClickListener(this);

Then you override the onMarkerClick method to get the title and position of the Marker.

@Override
public boolean onMarkerClick(Marker marker) {
    String title = marker.getTitle();
    LatLng position = marker.getPosition();

    return true;
}
Sky
  • 1,435
  • 1
  • 15
  • 24
  • Thank you! This helped me a lot. But how do I show more details of that marker? F.e. show picture of that place or show description? – user3575965 May 13 '17 at 13:22
  • 1
    I am glad I was able to help. I think you should implement `getPicture` and `getDescription` method in `InterestingPoint` class. – Sky May 13 '17 at 14:05