Android development Experience--Baidu Map SDK use

Source: Internet
Author: User

this post welcome reprint, reprint please indicate from http://www.cnblogs.com/qinxianyuzou/

If you have read this article have any questions about the Welcome to exchange, to Sina Weibo focus on my Android small-size farm , and jointly explore the application development of Android problems.

For a long time did not write the technology to share the paste, today we talk about Baidu Map SDK, by the way to yourself mark one.

In fact, now Baidu Map SDK has a lot of things are done, do not need to do a lot of work, but it is worth noting that the map with the positioning of Baidu now, so do some positioning and so on need to combine the two.

Baidu Map SDK Its own demo is a good example, I do not think I can write more than it is much better things, so you can refer to the demo.

So what am I going to say today? Let me tell you something about overlay and positioning.

Actually look at the demo, you can not difficult to learn the use of map positioning, you will easily display your map, covering layer is also the case, but I recently made a wonderful problem in the app, that is, when you use the overlay to mark some of the information you need to mark, the location icon is not. My depressed ah, spent a full two days to study why, but Leng did not study the reason why. But in the end do not know why the flash, the location of the icon and the overlay layer inherits the interface seems to be overlay interface, then will it affect each other? In the Baidu demo inside, you are not difficult to find the cover layer of the call of which there is such a sentence

1 mmapview.getoverlays (). Clear ();

The function of this code is clear already on the map of the cover, I looked, found that the location of the icon is actually a cover, so I think the location icon disappeared, because I cleared the cover. After testing, when I no longer draw the cover, that is, do not call the above code, the positioning icon is out again. So the result is obvious, the location icon disappears, because the above code to clear it out. How do we deal with that? I used a more stupid method, that is, after clearing the overlay, re-map the positioning layer to initialize once, then the location icon appears normally.

Mlmv_nearby_lv1.getoverlays (). Clear (); Baidumapmain.setlocationoverlay (); Mlmv_nearby_lv1.getoverlays (). Add ( Itemoverlay);

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.