Select to view content in your preferred language

Load mmpk file

747
1
11-02-2017 07:45 AM
LionelGOUBET
Regular Contributor

Hi,

I use android 100.1.0 and I try to load a mmpk file in android.

I see my map but it is empty no layers visibled !!

What's the problem ?

I don't understand ...

// create the mobile map package
        mapPackage = new MobileMapPackage(mmpkFile);


        // add done listener which will invoke when mobile map package has loaded
        mapPackage.addDoneLoadingListener(new Runnable() {
            @Override
            public void run() {
                // check load status and that the mobile map package has maps
                if(mapPackage.getLoadStatus() == LoadStatus.LOADED && mapPackage.getMaps().size() > 0){

                    Log.e(TAG, "***************** SUCCESS CHARGEMENT MMPK ********************");
                    // add the map from the mobile map package to the MapView
                    ArcGISMap map = mapPackage.getMaps().get(0);
                    if (map != null){
                        _mapView.setMap(map);
                        map.addDoneLoadingListener(
                                () ->
                                {
                                    Log.e(TAG, "******************************** Carte chargée");
                                    map.getOperationalLayers().stream().forEach(layer -> {
                                        if (layer.getLoadStatus() != LoadStatus.LOADED && layer.getLoadStatus() != LoadStatus.LOADING)
                                            // On force le chargement de tous les layers
                                            layer.loadAsync();
                                            Log.e(TAG, "******************************** Chargement du layer " + layer.getName());

                                    });
                                }

                        );
                        map.loadAsync();

                 
                    }
                    else{

                    }
                }else{
                    // Log an issue if the mobile map package fails to load
                    Log.e(TAG, mapPackage.getLoadError().getMessage());
                }
            }
        });
        // load the mobile map package asynchronously
        mapPackage.loadAsync();

Thanks for you help

0 Kudos
1 Reply
LionelGOUBET
Regular Contributor

Hi

do

_mapView.setMap(map); 

after 

addDoneLoadingListener

and it's work
0 Kudos