<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: attribute name-value pairs not updating in applyEdits in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/attribute-name-value-pairs-not-updating-in/m-p/287425#M1927</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Melo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First, Graphic objects are immutable, which means its state cannot change after construction. So, even though you change the attribute values, the Graphic object won't be modified. Second, featureLayer.createFeatureWithType(subType, geometry) will create a new feature based on the subtype. And all the attributes are set to default values defined for that subtype via template.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To do what you intended to do, add the following line before calling applyEdit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Graphic newGraphic = new Graphic(geometry, graphic.getSymbol(), attr, graphic.getInfoTemplate());&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This line create a new feature based on the existing geometry and updated attribute. Then pass this newGraphic to the applyEdit.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 11 Oct 2012 21:25:32 GMT</pubDate>
    <dc:creator>LiLin1</dc:creator>
    <dc:date>2012-10-11T21:25:32Z</dc:date>
    <item>
      <title>attribute name-value pairs not updating in applyEdits</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/attribute-name-value-pairs-not-updating-in/m-p/287424#M1926</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;When I applyEdits to the server, the location and subtype are properly transferred to a new record.&amp;nbsp; However, the attribute name-value pairs are not being updated.&amp;nbsp; I'm updating them using the &lt;/SPAN&gt;&lt;STRONG&gt;put&lt;/STRONG&gt;&lt;SPAN&gt; command.&amp;nbsp; Instead, the subtype's default attribute values are assigned to the new record.&amp;nbsp; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;PRE class="plain" name="code"&gt;public void applyEdits(Geometry geometry, FeatureType subType, ArcGISFeatureLayer featureLayer) { &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; //create a graphic using the type &amp;nbsp;&amp;nbsp;&amp;nbsp; Graphic graphic = featureLayer.createFeatureWithType(subType, geometry); &amp;nbsp;&amp;nbsp;&amp;nbsp; Map&amp;lt;String, Object&amp;gt; attr = graphic.getAttributes(); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attr.put("Number", count); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attr.put("ObserverID", userID); &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; attr.put("Behavior", behavior); &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; featureLayer.applyEdits(new Graphic[] {graphic}, null, null, new CallbackListener&amp;lt;FeatureEditResult[][]&amp;gt;() { &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void onError(Throwable error) {&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; public void onCallback(FeatureEditResult[][] editResult) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; } &amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; }); &amp;nbsp;&amp;nbsp;&amp;nbsp; finish(); &amp;nbsp; }&lt;/PRE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All the attributes I'm trying to update are strings.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 09 Oct 2012 04:40:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/attribute-name-value-pairs-not-updating-in/m-p/287424#M1926</guid>
      <dc:creator>Town_ofSnowflake</dc:creator>
      <dc:date>2012-10-09T04:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: attribute name-value pairs not updating in applyEdits</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/attribute-name-value-pairs-not-updating-in/m-p/287425#M1927</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Melo,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;First, Graphic objects are immutable, which means its state cannot change after construction. So, even though you change the attribute values, the Graphic object won't be modified. Second, featureLayer.createFeatureWithType(subType, geometry) will create a new feature based on the subtype. And all the attributes are set to default values defined for that subtype via template.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;To do what you intended to do, add the following line before calling applyEdit.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Graphic newGraphic = new Graphic(geometry, graphic.getSymbol(), attr, graphic.getInfoTemplate());&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This line create a new feature based on the existing geometry and updated attribute. Then pass this newGraphic to the applyEdit.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 21:25:32 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/attribute-name-value-pairs-not-updating-in/m-p/287425#M1927</guid>
      <dc:creator>LiLin1</dc:creator>
      <dc:date>2012-10-11T21:25:32Z</dc:date>
    </item>
    <item>
      <title>Re: attribute name-value pairs not updating in applyEdits</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/attribute-name-value-pairs-not-updating-in/m-p/287426#M1928</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Wow, great.&amp;nbsp; Thank you so much. I didn't realize that graphics were immutable.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 11 Oct 2012 21:52:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/attribute-name-value-pairs-not-updating-in/m-p/287426#M1928</guid>
      <dc:creator>Town_ofSnowflake</dc:creator>
      <dc:date>2012-10-11T21:52:46Z</dc:date>
    </item>
  </channel>
</rss>

