使用MapView加载地图非常方便

时间:2019-03-15 10:18:18

标签: android android-mapview here-maps-rest

当我使用Mapview加载地图时,可以显示地图,但是当操作地图时,它非常重要。使用SupportMapFragment加载映射时非常平稳。这是我的代码:

 private void initialize() {
    setContentView(R.layout.activity_main);
    boolean success = com.here.android.mpa.common.MapSettings.setIsolatedDiskCacheRootPath(
            getApplicationContext().getExternalFilesDir(null) + File.separator + ".here-maps",
            "com.here.android.tutorial.MapService");

    if (!success) {
        Toast.makeText(getApplicationContext(), "Unable to set isolated disk cache path.", Toast.LENGTH_LONG);
    } else {
        final MapView mapView = findViewById(R.id.mapview);
        mapView.setVisibility(View.VISIBLE);
        ApplicationContext context = new ApplicationContext(this);
        MapEngine.getInstance().init(context, new OnEngineInitListener() {
            @Override
            public void onEngineInitializationCompleted(Error error) {
                Map map = new Map();
                mapView.setMap(map);
            }
        });
    }      
}

有人可以帮助我吗?

0 个答案:

没有答案