ArcGIS Runtime Android SDK100.1.0 Offlinemap edit and synch

323 views Asked by At

I am able to download map from ArcGIS Android SDK-100.1.0, but after that how I will edit this map,i.e., add or delete a marker point and after this editing I will need to synch offline edit data to ArcGIS Map server. Here is my code of offline map --

private MapView mMapView;
private ArcGISMap map;
private ArcGISTiledLayer tiledLayer;
private Geodatabase geodatabase;
private Activity activity;

public void loadOfflineMap() {
    Toast.makeText(activity, activity.getFilesDir().getAbsolutePath(), Toast.LENGTH_LONG).show();

    //--- get links to cached resources
    String strTpkPath = activity.getFilesDir().getAbsolutePath()+"/tiles.tpk";
    String strGeoDbPath = activity.getFilesDir().getAbsolutePath()+"/layers.geodatabase";

    File sdCard = Environment.getExternalStorageDirectory();
    File dir = new File (sdCard.getAbsolutePath() + "/arcGIS");
    dir.mkdir();
    File file = new File(sdCard.getAbsolutePath() + "/testfile.txt");
    if (!file.exists()) {
        try {
            file.createNewFile();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    //--- create a tiled layer using the tile package
    TileCache tileCache = new TileCache(strTpkPath);
    tiledLayer = new ArcGISTiledLayer(tileCache);

    //--- set tiled layer as basemap
    Basemap basemap = new Basemap(tiledLayer);

    //--- create a map with the basemap
    map = new ArcGISMap(basemap);
    mMapView.setMap(map);

    //--- instantiate geodatabase with name
    geodatabase = new Geodatabase(strGeoDbPath);

    //--- load the geodatabase for feature tables
    geodatabase.loadAsync();

    //--- add feature layer from geodatabase to the ArcGISMap
    geodatabase.addDoneLoadingListener(new Runnable() {
        @Override
        public void run() {
            for (GeodatabaseFeatureTable geoDBTable: geodatabase.getGeodatabaseFeatureTables()) {
                mMapView.getMap().getOperationalLayers().add(new FeatureLayer(geoDBTable));
            }
        }
    });
}

I am unable to find any solution with this version of ArcGIS SDK. Please help me.

1

There are 1 answers

3
falldownhill On

Have you looked at the guides for editing: https://developers.arcgis.com/android/latest/guide/editing.htm

and syncing: https://developers.arcgis.com/android/latest/guide/sync-offline-edits.htm

There is also sample code for editing attachments: https://developers.arcgis.com/android/latest/sample-code/edit-feature-attachments.htm

If those don't answer any of your questions, let me know and I'll try to assist further.