Recent projects with the old version of the Baidu Map SDK, one of the requirements is to monitor the general coverage of the Click event, because this version does not exist so-called marker, the common cover is to write a class to inherit itemizedoverlay<overlayitem>. Listen to click the event more troublesome, need to overwrite itemizedoverlay inside of the Ontap method, but there are 2 ontap methods, should overwrite the parameter is an (int index) Ontap method, because another as long as the click of the map will be called, no matter where the click is the case, And I don't know why.
protected Boolean onTap (int arg0) How to get the clicked overlay in this method, just need a sentence of GetItem (arg0) on the line. Here's my Code.
/** * Listen for the overlay's Click event */@Overrideprotected boolean onTap (int arg0) {Super.ontap (arg0); GeoPoint Point=getitem (arg0). GetPoint ();//homefragment.mmapview.getoverlays (). Get (arg0). toString (); LOG.D ("22222", "Overlay--->" +arg0+ "----->point is" +point); return true;}
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Baidu Map 2.4.1SDK Monitor the Click event of the overlay