AnsweredAssumed Answered

How to delete feature using apply edits in Android API?

Question asked by suryakant on Nov 6, 2015
Latest reply on Nov 12, 2015 by suryakant

I am trying to delete feature from feature layer using apply edits by passing a graphic array as input, but it is showing me the error 'unable to complete operation, no adds,updates or deletes were specified'.

Also, if I am passing the same graphic for update operation then it is being updated successfully.

 

Following is the code snippet:

 

 

 

Map<String, Object> graphicAttributes = new HashMap<String, Object>();
  graphicAttributes.put("OBJECTID", 65);
 
  Graphic mfinalGraphic = new Graphic(null, null, graphicAttributes);
 


  arcGISFeatureLayer.applyEdits(null, new Graphic[]{mfinalGraphic}, null, new CallbackListener<FeatureEditResult[][]>() {
      @Override
      public void onCallback(final FeatureEditResult[][] featureEditResults) {
 
             runOnUiThread(new Runnable() {
             @Override
             public void run() {
             Toast.makeText(MainActivity.this, "Successfully deleted", Toast.LENGTH_LONG).show();
             }
  } );
  } 
 
  @Override
  public void onError(final Throwable throwable) {
  runOnUiThread(new Runnable() {
  @Override
  public void run() {
  Toast.makeText(MainActivity.this, "Failed to delete", Toast.LENGTH_LONG).show();
  }
  });
  }  });

While tracking on fiddler, I am getting the following request:

f=json&deletes=&token=BY26ICX0-KN....

 

The problem is at rest end if I pass only the object id in f=json&deletes=7&token=BY26ICX0-KN.... then it is getting deleted successfully.
But there is no way of passing only object id in apply edit for delete part in Android API.

 

Waiting for a positive reply

Outcomes