Baidu Map 2.4.1SDK Monitor the Click event of the overlay

Source: Internet
Author: User
Tags ontap

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.