AndroidアプリでBaiduマップを使いたいです。今まで、百度の地図を統合することができましたが、すべての緯度と経度の静的な地図を表示しています。私がこれまでに行ったことは次のとおりです。
public class BaiduMapActivity extends AppCompatActivity{
@SuppressWarnings("unused")
private static final String LTAG = BaiduMapActivity.class.getSimpleName();
private MapView mMapView;
private BaiduMap mBaiduMap;
// ********bejing**********
double lat = 39.9167;
double longi = 116.3833;
double shanghaiLat = 31.2000;
double shangaiLong = 121.5000;
Context mContext = BaiduMapActivity.this;
RoutePlanSearch mSearch = null; // 搜索模块,也可去掉地图模块独立使用
RouteLine route = null;
OverlayManager routeOverlay = null;
boolean useDefaultIcon = false;
private boolean canGetLocation;
private double singaporeLat = 1.3000;
private double singaporeLong = 103.8000;
private double hongkongLat = 22.2783;
private double hongkongLong = 114.1747;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_baidu_maps_layout);
init();
try {
mBaiduMap = mMapView.getMap();
mBaiduMap.setMyLocationEnabled(true);
MyLocationData locData = new MyLocationData.Builder()
.direction(100).latitude(hongkongLat).longitude(hongkongLong).build();
//loads same map even if lat long are changed
mBaiduMap.setMyLocationData(locData);
}catch (Exception e){
e.printStackTrace();
}
}
private void init() {
mMapView = (MapView) findViewById(R.id.baidu_mapview_id);
}
@Override
protected void onPause() {
super.onPause();
mMapView.onPause();
}
@Override
protected void onResume() {
super.onResume();
mMapView.onResume();
}
@Override
protected void onDestroy() {
super.onDestroy();
mMapView.onDestroy();
}
}
異なる緯度経度のマップをロードする方法は?