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); } });
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).
Comments
Post a Comment