Hi,
I want to be able to add features to a runtime content dataset (.geodatabase) with the following scenario: I have a points-dataset (points.geodatabase) stored on my android device, I built an app that views these points, and I want to edit this dataset from my android device by adding a new point feature (with 150,000 x-coordinate and 160000 y-coordinate) to it. I tried the standard guide in this link and wrote the code below but still, the dataset is not edited and the new point is not added.
My question is: How can I add features to a .geodatabase dataset from my android device?
Any help is highly appreciated
Hani
Button btn = (Button) findViewById(R.id.button1);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//make a map of attributes
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("Name_English", "PointA");
/*point=(Point) locgraphic.getGeometry();*/
point=new Point(150000, 160000);
try {
//Create a feature with these attributes at the given point
GeodatabaseFeature gdbFeature = new GeodatabaseFeature(attributes, point, gft);
//Add the feature into the geodatabase table (gft) gft.addFeature(gdbFeature);
s.addGraphic(new Graphic(point, new SimpleMarkerSymbol(Color.RED,15,SimpleMarkerSymbol.STYLE.CIRCLE)));
} catch (TableException e) {
// report errors, e.g. to console
}
Toast.makeText(getApplicationContext(), "Saved!", 3000).show();
}
});
Button btn = (Button) findViewById(R.id.button1);
btn.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
//make a map of attributes
Map<String, Object> attributes = new HashMap<String, Object>();
attributes.put("Name_English", "PointA");
/*point=(Point) locgraphic.getGeometry();*/
point=new Point(150000, 160000);
try {
//Create a feature with these attributes at the given point
GeodatabaseFeature gdbFeature = new GeodatabaseFeature(attributes, point, gft);
//Add the feature into the geodatabase table (gft) gft.addFeature(gdbFeature);
s.addGraphic(new Graphic(point, new SimpleMarkerSymbol(Color.RED,15,SimpleMarkerSymbol.STYLE.CIRCLE)));
} catch (TableException e) {
// report errors, e.g. to console
}
Toast.makeText(getApplicationContext(), "Saved!", 3000).show();
}
});