http://www.eoeandroid.com/thread-327942-1-1.html
http://www.eoeandroid.com/thread-303777-1-1.html
一开始当然是mapView的初始化
mapView = (MapView) findViewById(R.id.map);
mapView.onCreate(savedInstanceState);// 此方法必须重写
可以在初始化中加上缩放和指南针
/**
* 初始化
*/
private void init() {
if (aMap == null) {
aMap = mapView.getMap();
setUpMap();
mUiSettings = aMap.getUiSettings();
mUiSettings.setScaleControlsEnabled(true);
mUiSettings.setCompassEnabled(true);
}
}
当然少不了这个方法:
/**
* 定位成功后回调函数
*/
@Override
public void onLocationChanged(AMapLocation aLocation) {
if (mListener != null && aLocation != null) {
mListener.onLocationChanged(aLocation);// 显示系统小蓝点
marker.setPosition(new LatLng(aLocation.getLatitude(), aLocation
.getLongitude()));// 定位雷达小图标
float bearing = aMap.getCameraPosition().bearing;
aMap.setMyLocationRotateAngle(bearing);// 设置小蓝点旋转角度
}
}
V2.0.4-->V2.2.1
import com.amap.api.services.route.BusRouteResult;
import com.amap.api.services.route.RouteSearch;
import com.amap.api.services.route.RouteSearch.BusRouteQuery;
//import com.amap.api.search.core.AMapException;
//import com.amap.api.search.core.LatLonPoint;
//import com.amap.api.search.route.Route;