1

Im quite new in arcmap map and i have been spending more than 2 week stuck in how to show map online offline. I have tried the code is attached but when i run the application.It crashes nothing to show. You can see my code and i also attached geodatabase file.

i follow this tutorial: http://www.activeg.com/agBlog/android-running-an-arcgis-map-offline

And my geodatabase file is here https://files.fm/u/q5xuznvy

I just want to thank you in advance to those who are willing to share.

MapView mMapView;
Geodatabase geodatabase;
private GeodatabaseFeatureTable geodatabaseFeatureTable;
private FeatureLayer featureLayer;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    mMapView = (MapView) findViewById(R.id.map); //Instantiates the MapView object
    LoadMap mLoadMap = new LoadMap(); //Runs the LoadMap class on another thread
    mLoadMap.execute(); //Calls the background thread
}


private class LoadMap extends AsyncTask<Void, Void, Void> {

    @Override
    protected Void doInBackground(Void... params) {

        try { //Opens up the basemap.geodatabase file from it's location on the physical device
            Log.d("_EXC", "Loading File");
            geodatabase = new Geodatabase("/mnt/shared/Database/mygeodata.gdb");
            Log.d("_EXC", "File Loaded");
        } catch (FileNotFoundException e) {
            Log.d("_EXC", e.getMessage());
        } finally { //Takes each layer one by one from the Geodatabase and adds it to the MapView
            if (geodatabase == null){
                Log.d("_EXC", "File not Loaded");
            }
            for (int i = (geodatabase.getGeodatabaseTables().size()) - 1; i >= 0; i--) {
                geodatabaseFeatureTable = geodatabase.getGeodatabaseFeatureTableByLayerId(i);
                featureLayer = new FeatureLayer(geodatabaseFeatureTable);
                mMapView.addLayer(featureLayer);
            }
        }
        return null;
    }
}

}`

zohaib
  • 11
  • 1

0 Answers0