AnsweredAssumed Answered

How to add a feature in an existing GeodatabaseFeatureTable

Question asked by durand.gael on Sep 13, 2017
Latest reply on Sep 13, 2017 by durand.gael

I'm trying to add a new feature into an existing GeodatabaseFeatureTable but I get the following error when createFeature is called:

com.esri.arcgisruntime.ArcGISRuntimeException: Cannot call this method in this context

 

Here is the code:

    // create a new Geodatabase from local path
    mGeodatabase = new Geodatabase(mGeoDb);
    // load the geodatabase
    mGeodatabase.loadAsync();
    // add feature layer from geodatabase to the ArcGISMap
    mGeodatabase.addDoneLoadingListener(new Runnable() {
    @Override
    public void run() {
        for (GeodatabaseFeatureTable geoDbTable : mGeodatabase.getGeodatabaseFeatureTables()){
            java.util.Map<String, Object> attributes = new HashMap<String, Object>();
            attributes.put("COD", "SIG");
               
            Point gps = new Point(-1.640235, 48.127568, SpatialReferences.getWgs84());
            Feature addedFeature = geoDbTable.createFeature(attributes, gps);
        }
    }

Any help would be appreciated.

Outcomes