Simple positioning of Android Google Maps (2)

Source: Internet
Author: User

In simple positioning of Android Google Maps (1), we have obtained world maps. In fact, we have a lineCodeI haven't written it yet. If I add some code in mainactivity, we can simply locate it ~~~

1,Source code(The code is added on the basis of the previous code, if you do not know how to get the world map, see the http://blog.csdn.net/woshishuoshuoa/article/details/9774491)

2. Note: supportmapfragment is suitable for versions earlier than API 12. It must inherit fragmentactivity from activity; mpafragment is suitable for Versions later than API 12, and class = "com. google. android. GMS. maps. supportmapfragment "/> inherits the activity.

For example, retrieve GoogleMap map = (supportmapfragment) getsupportfragmentmanager (). findfragmentbyid (R. Id. Map). getmap () below map object API 12 ();
GoogleMap map = (mapfragment) getfragmentmanager (). findfragmentbyid (R. Id. Map). getmap ();

3. Running result:

This article is just a simple implementation of the positioning, relatively simple, hope that Android users like to propose a better idea to share Oh ~~~ If you need to repost this article, please indicate the source. Although this article is relatively simple, it can also be copyrighted ~~~ Thank you for your comments ~~~ If you are interested, read http://blog.csdn.net/woshishuoshuoa/article/details/9793327.

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.