Adding buttons to map infowindow android

In the new Google Maps for Android API v2, I can very easily get custom markers and info windows to display. However, I’m trying to have multiple buttons inside of my info window, that each perform a different onClick action but the problem is, the map treats the InfoWindow as it’s own button object (no matter where I click on the InfoWindow, it presses the entire thing). Does anyone know how to customize this a bit more?

  • Is it possible to trigger share menu on smartphones (via HTML/JS)?
  • GetFragmentManager.findFragmentByTag() returns null
  • How can I add items to a spinner in Android?
  • Create Wifi Hotspot Configuration in android
  • Failure to install APK Android Studio
  • TextView Within Gallery
  • Related posts:

    How to add actions to the top part of a split ActionBar
    What is “Resources” in BitmapDrawable constructor really?
    How can I make my EditText five lines high without using android:inputType=“textMultiLine&...
    Android Unit Test with Retrofit and Mockito
    Nexus 6 and MediaPlayer.VIDEO_SCALING_MODE_SCALE_TO_FIT_WITH_CROPPING);
    Android google maps button style
  • Can't create handler inside thread which has not called Looper.prepare()
  • Android/Gradle espresso test not starting activity
  • Cordova InAppBrowser and shared cookie with webview
  • WARNING : No target specified, deploying to emulator
  • Handling back press when using fragments in Android
  • Android, How to remove all markers from Google Map V2?
  • One Solution collect form web for “Adding buttons to map infowindow android”

    Just found this in the documentation.

    As mentioned in the previous section on info windows, an info window
    is not a live View, rather the view is rendered as an image onto the
    map. As a result, any listeners you set on the view are disregarded
    and you cannot distinguish between click events on various parts of
    the view. You are advised not to place interactive components — such
    as buttons, checkboxes, or text inputs — within your custom info
    window.

    Unfortunately, that answers it. I was trying to add the same function as you.

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.