• Announcements

    • EmperoR

      Dear Guests   12/24/2016

      Welcome to the GIS-AREA. like most online communities you must register to view or post in our community, but don't worry this is a simple free process that requires minimal information for you to signup. Be a part of GIS-AREA by signing in or creating an account here. Once you have created your account and have introduced yourself to our community, you can start new topics, reply to others, subscribe interesting threads, get your customize profiles, make news friends, and others nice stuff. To make your stay as pleasant and constructive as possible, please don't forget to read through our pinned forum rules and board guidelines in each section before you do anything else.
Sign in to follow this  
Followers 0
deepgis

DIsplay a Map while Offline

1 post in this topic

Respected All,

I am learning online tutorials for webmapping using ArcGIS Runtime SDK for Android. I did all the steps according to the tutorial. I saved the .mmpk file on my sd card. But  my device doesn't recognize it. I am not programmer so I think I need to correct the file path in the code. Need help. I am using the same as written  below-

Add a new method to load the mmpk file into a Map object and then update your MapView to display it.

The file path used here may differ depending on how you loaded the file on your device. You may be required to alter the path to the file accordingly.

Loading the map package file is an asynchronous process because you do not want to block the device while the file loads.

If it fails to load the map package we fall back and show the online map.

 private void setupMobileMap() {
     if (mapView == null) {
         mapView = new MapView();
     }
     String mmpkFile = "devlabs-package.mmpk";
     final MobileMapPackage mapPackage = new MobileMapPackage(mmpkFile);
     mapPackage.addDoneLoadingListener(new Runnable() {
         @Override
         public void run() {
             // Verify the file loaded and there is at least one map
             if (mapPackage.getLoadStatus() == LoadStatus.LOADED && mapPackage.getMaps().size() > 0) {
                 mapView.setMap(mapPackage.getMaps().get(0));
             } else {
                 // Error if the mobile map package fails to load or there are no maps included in the package
                 setupMap();
             }
         }
     });
     mapPackage.loadAsync();
 }

 

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0