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

user1977908 picture user1977908 · May 21, 2013 · Viewed 28.3k times · Source

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!

Answer

Quickcoding picture Quickcoding · May 21, 2013

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);


            }
        });