unable to open database file

2616
3
06-20-2016 02:57 PM
BernardNtiamoah
New Contributor

I am trying to update an existing feature and it's giving this error

here is the code.

selectedFeatureLayer.getFeatureTable().updateFeature(selectedFeature.getId(), feature);

0 Kudos
3 Replies
AlexanderNohe1
Occasional Contributor III

Can you please share your error message?

I only see the method call that you are making.

0 Kudos
BernardNtiamoah
New Contributor

The error message is "unable to open the database file". The weird thing is that sometimes it works and the feature gets updated successfully. I don't really know what's causing this issue.

here is the code :

try {

  TemplatePicker tp = context.getTemplatePicker();

MapView map = context.getMapView();

  GeodatabaseFeature g = ((GeodatabaseFeatureTable) ((FeatureLayer) map.getLayerByID(tp.getSelectedLayer().getID())).getFeatureTable()).createFeatureWithTemplate(tp.getselectedTemplate(), geometryBeingEdited);

  Symbol symbol = ((FeatureLayer) map
   .getLayerByID(tp
   .getSelectedLayer().getID())).getRenderer()

  .getSymbol(g);

  addedGraphic = new Graphic(geometryBeingEdited, symbol, g.getAttributes());

   updatedfeatureId = ((FeatureLayer) map.getLayerByID(tp.getSelectedLayer().getID())).getFeatureTable().addFeature(addedGraphic);

} catch (TableException e) {

  e.printStackTrace();

}

0 Kudos
AlexanderNohe1
Occasional Contributor III

To follow up, we discussed this offline and it looked as though it was a caching issue in the code / on the device and that is what prevented the geodatabase file from opening.

0 Kudos