How to get click of buttons inside balloons in android google map v2? -


i working on googlemap v2 in android, have markers on map, clicking on marker opening infowindow. in info window have 4 textview , 2 buttons. want perform different action clicking on these 2 buttons: in case button 1 direction , button2 make phone call. have no idea how can please me find solution of problem. better understanding attached image of infowindow. below code tried fire intents:

phonebtn.setonclicklistener(new onclicklistener() {                  @override                 public void onclick(view v) {                     // todo auto-generated method stub                     intent callintent = new intent(intent.action_call);                     callintent.setdata(uri.parse("tel:"                             + phonetext.gettext().tostring()));                     system.out.println("clicking");                     activity.startactivity(callintent);                 }             });  

enter image description here

quoting form docs

info window not respect of interactivity typical normal view such touch or gesture events. can listen generic click event on whole info window described below.

info window not live view, rather view rendered image onto map. result, listeners set on view disregarded , cannot distinguish between click events on various parts of view. advised not place interactive components — such buttons, checkboxes, or text inputs — within custom info window.

you can use oninfowindowclicklistener listen click events on info window. set listener on map, call googlemap.setoninfowindowclicklistener(oninfowindowclicklistener). when user clicks on info window, oninfowindowclick(marker) called , info window highlighted in default highlight color (holo blue devices running ice cream sandwich , newer, orange earlier versions of android).

https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/googlemap.oninfowindowclicklistener


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -