- well, Baidu maps,
- Baidu maps, there are all kinds of tall features on offer, I will not. These two smallpox time looked at, ready to make a tall on the app out. I found that I want to more.
- then, just a function of location, and show my location on the map,..
- OK, let's start with the implementation of these two functions,
- first, go to the Baidu Developer Center to download the Baidu maps SDK lib package, and then put it in your own project's lib package,.
- then, Ann according to the official website provided code, step by step down to copy, log inside can print out the current position,.
- again, and then the
MapViewis also copied according to the official website code, you can display the map, but the default location is Tiananmen in Beijing. Obviously, this is not what we want the effect.
LatLng, latLng = new, LatLng (mLatitude, mLongitude);
MapStatusUpdate statusUpdate = MapStatusUpdateFactory.newLatLng (latLng);
MBaiduMap.animateMapStatus (statusUpdate); / / display the current location in the center of the map to
MBaiduMap.setMyLocationEnabled (true); / / open to display the current location icon
With the lines above, you can display the current position on the map. Pay particular attention to the setting of the last switch, you must set it, or else it doesn't work.
* by the way, the Java's default observer pattern API is pretty good, as long as it's in the production data method of the
setChanged ();); call these 3 lines of code, and then the observer (
onUpdate) in themethod can obtain the latest production data in real time. Of course, the premise is that need to be added to the
Observerclass container. Also is called the observer Java enhanced api
- because I have such a demand, not only allows users to see the positioning information in the non map interface, and allows the user to see the location information in the map interface, so I will be the two interface as the observer, the listener will get the location information as observation to achieve such a demand for.
- Baidu map SDK API call is not introduced, believe that the introduction of the website is better than me. In addition, if you want to use Baidu map SDK, see the official website API and no eggs for children's shoes, please see the the video on the very good however, because it is in the 14 years, there are some subtle differences in API or to achieve the effect of possible and you the same code can achieve the effect. For example, the current location of the map display, it must be according to what I said above 3 lines of code to do, follow the link tutorial may have no way to see the current position..
- well, that's about it,.
- according to convention, finally must ha ha ha's
Using Baidu maps Android SDK
- The compiler statically linked Git3 years ago1546 Views
- Androd screen switching activity li3 years ago1448 Views
- Apk runs on subcontract after java.3 years ago780 Views
- [Android] listen for custom notific3 years ago813 Views
- From the perspective of the JAVA me3 years ago1512 Views
- Android design patterns - single mo3 years ago1628 Views
- Dialog box in Android3 years ago1652 Views
- Au automatic updates to understand 3 years ago1934 Views
- Python Baidu Post Bar crawler3 years ago1743 Views
- Android (a) Title Note on pit gradi3 years ago1703 Views