xzhang_usa

Fail to create new feature

Discussion created by xzhang_usa on Aug 24, 2012
All,

I'm creating an app to allow user to add new point feature in feature server layer.
But for whatever reason, it failed to create new feature(it printed from LogCat in Log.d(TAG, "Creation Failure...") codel ine).
       }

Any idea?

Thanks,

Xiaoyi


++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

  public void AddNewFeature(Geometry geometry, ArcGISFeatureLayer pFeatureLayer) {

   //create a graphic using the template
   FeatureType[] featureTypes = pFeatureLayer.getTypes();
  
   if (featureTypes == null || featureTypes.length == 0)
   {
   messageBox("Cannot find Feature Templates...");
   return;
   }
   else
   {
    Graphic graphic = pFeatureLayer.createFeatureWithType(featureTypes[0], geometry);
    if (graphic != null)
    {
     pFeatureLayer.applyEdits(new Graphic[] { graphic }, null, null, new CallbackListener<FeatureEditResult[][]>()
     {
      public void onError(Throwable error) {
      Log.d(TAG, "Error: " + error.getMessage());
      }

      public void onCallback(FeatureEditResult[][] editResult)
      {
       // Check the response for success or failure
       if (editResult[0] != null && editResult[0][0] != null && editResult[0][0].isSuccess())
       {
       Log.d(TAG, "Creation Success...");
       }
       else
       {
       Log.d(TAG, "Creation Failure...");
       }
      }
     });
    }
   }
  }




++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Outcomes