A map flash problem occurs when the Android Baidu map is refreshed after frequent overlay adding (personal)

Source: Internet
Author: User

When I got to work in a new company, I looked at other people's projects, debugged the bugs, and found that the map was refreshed in one second, and Baidu map was flashing. According to the previous Baidu Map Project, I did not encounter this situation, but I also did not flash when I frequently added the cover and refreshed it. Later I looked at the previous Code and found the cause of the flash.

List ListvoerlaysList = mMapView. getOverlays (); // gets the map layer list.

ListvoerlaysList. add (mOverlay); // add a custom overlay.

MOverlay. addItem (overlayItem); // Add annotation points to the covering

We should directly operate on the covering layer when replacing the covering layer,

MOverlay. removeAll (); instead of listvoerlaysList. removeAll (arg0)

Simply put, the opposite error is that the covering layer cannot be added or deleted frequently; otherwise, the layer will flash. I mean, do not modify the layer frequently after it is added, you only need to modify the vertices on the layer to be the labels on the cover. You can operate the mOverlay object.



Related Article

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.