Search code examples
androidgoogle-mapsandroid-activitygoogle-maps-markersinfowindow

Android Google Map v2 - Starting activity when clicking on marker infoWindow


I have seen that people are finding a lot of difficulties with this specific task and I am in need of help as well.

I have successfully created Markers on a Map using the default code that Google has provided. But now I want to be able to click on "InfoWindow" to open a new activity so I can add more information.

Does anyone know the best way to do this?

If you can answer this please put up some code or an example. Any help would be much appreciated!


Solution

  • add this to your code

     Mymap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
                @Override
                public void onInfoWindowClick(Marker marker) {
                   Intent intent = new Intent(MapActivity.this,OtherActivity.class);
                   startActivity(intent);
    
    
                }
            });