Android Baidu map v3.2.0 obtains the actual address

Source: Internet
Author: User

Android Baidu map v3.2.0 obtains the actual address

After Baidu map is upgraded to v3.2.0, the api changes a lot, but the downloaded Demo is not the latest version.

Obtain the detailed address before v3.2.0 as long as: option. setIsNeedAddress (true );

However, after the upgrade, the api changes a lot and the attribute cannot be found. So can only study the use of new APIs, but it is a pity that I haven't found the latest usage for getting the detailed address for a long time (if you know, please let me know !!)


Huang Tianyan is an easy-to-lose man. Finally, he found a class GeoCoder in his mind. He successfully obtained the detailed address, using the following:

GeoCoder coder = GeoCoder. newInstance (); ReverseGeoCodeOption reverseCode = new ReverseGeoCodeOption (); ReverseGeoCodeOption result = reverseCode. location (new LatLng (location. getLatitude (), location. getlongpolling (); coder. reverseGeoCode (result); coder. setOnGetGeoCodeResultListener (new OnGetGeoCoderResultListener () {@ Overridepublic void onGetReverseGeoCodeResult (ReverseGeoCodeResult result) {Log. I ("=", "onGetReverseGeoCodeResult:" + result. getAddress () ;}@ Overridepublic void onGetGeoCodeResult (GeoCodeResult result) {Log. I ("=", "onGetGeoCodeResult:" + result. getAddress ());}});
Note: location is the result returned after positioning. In the BDLocationListener interface !!

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.