1

hi i have a question about infowindow on android google map.

 @Override
        public View getInfoWindow(Marker arg0) {
            return null;
        }

like this picture infowindow with menus

i want to make a infowindow with other menu inside of it. when i click Directions then google map will shown up, and if i click another text will show another activity. i know that picture from goole map javascript

 @Override
        public View getInfoWindow(Marker arg0) {
            return null;
        }
kucluk
  • 540
  • 2
  • 9
  • 29

1 Answers1

2

this cannot be done.

from the docs

The info window that is drawn is not a live view. The view is rendered as an image (using View.draw(Canvas)) at the time it is returned. This means that any subsequent changes to the view will not be reflected by the info window on the map. To update the info window later (for example, after an image has loaded), call showInfoWindow(). Furthermore, the info window will not respect any of the interactivity typical for a normal view such as touch or gesture events. However you can listen to a generic click event on the whole info window as described in the section below.

so the window is not an active view just an image, the best you can do is show a dialog when the info windo is clicked

tyczj
  • 71,600
  • 54
  • 194
  • 296
  • Info window is not a live view - this is true, but are you sure it cannot be done? Have you tried running this app: https://play.google.com/store/apps/details?id=com.circlegate.tt.transit.android&hl=en ? – MaciejGórski Oct 09 '13 at 18:09
  • have I tried that, no I dont live in russia and im not about to try to get the app to work with my location. who is to say its not a custom view they created though if it does work like that – tyczj Oct 09 '13 at 19:28
  • It's Google Maps Android API v2 info window created using `InfoWindowAdapter`. Saying it cannot be done might not be appropriate. – MaciejGórski Oct 09 '13 at 20:29
  • 1
    You can't do it using what Google has provided in the Android Maps API. If you're planning on inserting a lot of clickable items I suggest you just display a View outside of the map. That way, you won't have a bloated infoWindow covering up a large part of your map. You could come up with something like [this](http://pitstopph-dilimanlabs.appspot.com/) now that they've added a [`setPadding()`](https://developers.google.com/maps/documentation/android/releases#september_2013) method. – user1923613 Oct 10 '13 at 04:02