<?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: Update graphic on Graphic layer with new Geo point(new current location) in ArcGIS Runtime SDK for Android Questions</title>
    <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-graphic-on-graphic-layer-with-new-geo-point/m-p/320451#M2121</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The API has changed a little, but once you have understood the new concepts it will work well for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your application it sounds like you are maintaining your own locations which you display in your app.&amp;nbsp; If this is the case then the container you will want to use is a GraphicsOverlay.&amp;nbsp; I have shown some very simple code below which creates a graphics overlay, adds it to your MapView and adds a graphic.&amp;nbsp; It then goes on to move the graphic straight away.&amp;nbsp; Note that the Point class is immutable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #808080;"&gt;// create a graphics overlay
&lt;/SPAN&gt;GraphicsOverlay graphicsOverlay = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;GraphicsOverlay()&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #9876aa;"&gt;mapView&lt;/SPAN&gt;.getGraphicsOverlays().add(graphicsOverlay)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// make a symbol for your graphic - this is just a dot
&lt;/SPAN&gt;SimpleMarkerSymbol simpleMarkerSymbol = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;SimpleMarkerSymbol(SimpleMarkerSymbol.Style.&lt;SPAN style="color: #9876aa;"&gt;CIRCLE&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;0xFF00FF00&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;10&lt;/SPAN&gt;)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// make a point geometry - note its immutable.
&lt;/SPAN&gt;Point initialPoint = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;Point(&lt;SPAN style="color: #6897bb;"&gt;1000&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;1000&lt;/SPAN&gt;)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// create your graphic from the symbol and geometry
&lt;/SPAN&gt;Graphic graphic = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;Graphic(initialPoint&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;simpleMarkerSymbol)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// add it to the graphics overlay - this will allow you to see the point
&lt;/SPAN&gt;graphicsOverlay.getGraphics().add(graphic)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// this code section is for moving the graphic to a new location
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// start by creating a new point
&lt;/SPAN&gt;Point newPoint = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;Point(&lt;SPAN style="color: #6897bb;"&gt;5000&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;5000&lt;/SPAN&gt;)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// apply the new point to the graphic
&lt;/SPAN&gt;graphic.setGeometry(newPoint)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// your graphic is now in the new location!&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is lots of documentation explaining how this work here:&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/android/latest/guide/add-graphics-and-text-to-graphics-overlays.htm" title="https://developers.arcgis.com/android/latest/guide/add-graphics-and-text-to-graphics-overlays.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Add graphics and text to graphics overlays—ArcGIS Runtime SDK for Android | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are also samples in gitHub.&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/java" title="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/java" rel="nofollow noopener noreferrer" target="_blank"&gt;arcgis-runtime-samples-android/java at master · Esri/arcgis-runtime-samples-android · GitHub&lt;/A&gt;&amp;nbsp;&amp;nbsp;(Kotlin examples are there too if you prefer).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is an example of a 3D app which shows how to rapidly update graphics which you can take a look at:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/java/animate-3d-graphic" title="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/java/animate-3d-graphic" rel="nofollow noopener noreferrer" target="_blank"&gt;arcgis-runtime-samples-android/java/animate-3d-graphic at master · Esri/arcgis-runtime-samples-android · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 11 Dec 2021 15:12:52 GMT</pubDate>
    <dc:creator>MarkBaird</dc:creator>
    <dc:date>2021-12-11T15:12:52Z</dc:date>
    <item>
      <title>Update graphic on Graphic layer with new Geo point(new current location)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-graphic-on-graphic-layer-with-new-geo-point/m-p/320450#M2120</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We have migrated ArcGis library from 10x to 100.9.0.&lt;/P&gt;&lt;P&gt;In our app we have the functionality of change mock location using long press. Below is the code snippet of 10x which is working fine.&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Graphic graphic = mGraphicsLayer.getGraphic(marker);&lt;BR /&gt; if (graphic != null) {&lt;BR /&gt; Point point = LocationUtils.convertToMapPoint(position, getSpatialReference());&lt;BR /&gt; final Point geometry = (Point) graphic.getGeometry();&lt;BR /&gt; geometry.setXY(point.getX(), point.getY());&lt;/P&gt;&lt;P&gt;mGraphicsLayer.updateGraphic(marker, geometry);&lt;BR /&gt; mGraphicsLayer.bringToFront(marker);&lt;BR /&gt; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&amp;nbsp;After Migration we does not found any method like update graphic and change location of marker which is already drawn on Graphic layer. We have more than 1000 marker on Map so also not feasible to clear and redraw all again. I tried so much but there are no such documentation help. So we are stuck now. Please help and provide code snippet to migrate above code with new library.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2020 07:05:28 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-graphic-on-graphic-layer-with-new-geo-point/m-p/320450#M2120</guid>
      <dc:creator>KalpitMistry</dc:creator>
      <dc:date>2020-09-29T07:05:28Z</dc:date>
    </item>
    <item>
      <title>Re: Update graphic on Graphic layer with new Geo point(new current location)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-graphic-on-graphic-layer-with-new-geo-point/m-p/320451#M2121</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The API has changed a little, but once you have understood the new concepts it will work well for you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In your application it sounds like you are maintaining your own locations which you display in your app.&amp;nbsp; If this is the case then the container you will want to use is a GraphicsOverlay.&amp;nbsp; I have shown some very simple code below which creates a graphics overlay, adds it to your MapView and adds a graphic.&amp;nbsp; It then goes on to move the graphic straight away.&amp;nbsp; Note that the Point class is immutable.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #808080;"&gt;// create a graphics overlay
&lt;/SPAN&gt;GraphicsOverlay graphicsOverlay = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;GraphicsOverlay()&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #9876aa;"&gt;mapView&lt;/SPAN&gt;.getGraphicsOverlays().add(graphicsOverlay)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// make a symbol for your graphic - this is just a dot
&lt;/SPAN&gt;SimpleMarkerSymbol simpleMarkerSymbol = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;SimpleMarkerSymbol(SimpleMarkerSymbol.Style.&lt;SPAN style="color: #9876aa;"&gt;CIRCLE&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;0xFF00FF00&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;10&lt;/SPAN&gt;)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// make a point geometry - note its immutable.
&lt;/SPAN&gt;Point initialPoint = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;Point(&lt;SPAN style="color: #6897bb;"&gt;1000&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;1000&lt;/SPAN&gt;)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// create your graphic from the symbol and geometry
&lt;/SPAN&gt;Graphic graphic = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;Graphic(initialPoint&lt;SPAN style="color: #cc7832;"&gt;, &lt;/SPAN&gt;simpleMarkerSymbol)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// add it to the graphics overlay - this will allow you to see the point
&lt;/SPAN&gt;graphicsOverlay.getGraphics().add(graphic)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// this code section is for moving the graphic to a new location
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// start by creating a new point
&lt;/SPAN&gt;Point newPoint = &lt;SPAN style="color: #cc7832;"&gt;new &lt;/SPAN&gt;Point(&lt;SPAN style="color: #6897bb;"&gt;5000&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb;"&gt;5000&lt;/SPAN&gt;)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// apply the new point to the graphic
&lt;/SPAN&gt;graphic.setGeometry(newPoint)&lt;SPAN style="color: #cc7832;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080;"&gt;// your graphic is now in the new location!&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is lots of documentation explaining how this work here:&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="https://developers.arcgis.com/android/latest/guide/add-graphics-and-text-to-graphics-overlays.htm" title="https://developers.arcgis.com/android/latest/guide/add-graphics-and-text-to-graphics-overlays.htm" rel="nofollow noopener noreferrer" target="_blank"&gt;Add graphics and text to graphics overlays—ArcGIS Runtime SDK for Android | ArcGIS for Developers&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are also samples in gitHub.&amp;nbsp;&amp;nbsp;&lt;A class="link-titled" href="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/java" title="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/java" rel="nofollow noopener noreferrer" target="_blank"&gt;arcgis-runtime-samples-android/java at master · Esri/arcgis-runtime-samples-android · GitHub&lt;/A&gt;&amp;nbsp;&amp;nbsp;(Kotlin examples are there too if you prefer).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There is an example of a 3D app which shows how to rapidly update graphics which you can take a look at:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/java/animate-3d-graphic" title="https://github.com/Esri/arcgis-runtime-samples-android/tree/master/java/animate-3d-graphic" rel="nofollow noopener noreferrer" target="_blank"&gt;arcgis-runtime-samples-android/java/animate-3d-graphic at master · Esri/arcgis-runtime-samples-android · GitHub&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does this help?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:12:52 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-graphic-on-graphic-layer-with-new-geo-point/m-p/320451#M2121</guid>
      <dc:creator>MarkBaird</dc:creator>
      <dc:date>2021-12-11T15:12:52Z</dc:date>
    </item>
    <item>
      <title>Re: Update graphic on Graphic layer with new Geo point(new current location)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-graphic-on-graphic-layer-with-new-geo-point/m-p/320452#M2122</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for the quick reply.&lt;BR /&gt;Add marker on graphic layer and the simple straight forward document I already referred but the problem is lots of methods are not available in new library. even alternate method is not mentioned anywhere in document. So if you are aware about how to update the existing marker position which already drawn on map.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:40:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-graphic-on-graphic-layer-with-new-geo-point/m-p/320452#M2122</guid>
      <dc:creator>KalpitMistry</dc:creator>
      <dc:date>2020-09-29T09:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Update graphic on Graphic layer with new Geo point(new current location)</title>
      <link>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-graphic-on-graphic-layer-with-new-geo-point/m-p/320453#M2123</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The code in the example I have above explains how to move a graphic.&amp;nbsp; You just need to create a new geometry and apply it to the existing graphic.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="lia-code-sample line-numbers language-none"&gt;&lt;SPAN style="color: #808080; border: 0px; font-weight: inherit; font-size: 18px;"&gt;// this code section is for moving the graphic to a new location
&lt;/SPAN&gt;&lt;SPAN style="color: #808080; border: 0px; font-weight: inherit; font-size: 18px;"&gt;// start by creating a new point
&lt;/SPAN&gt;Point newPoint = &lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 18px;"&gt;new &lt;/SPAN&gt;Point(&lt;SPAN style="color: #6897bb; border: 0px; font-weight: inherit; font-size: 18px;"&gt;5000&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 18px;"&gt;,&lt;/SPAN&gt;&lt;SPAN style="color: #6897bb; border: 0px; font-weight: inherit; font-size: 18px;"&gt;5000&lt;/SPAN&gt;)&lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 18px;"&gt;;
&lt;/SPAN&gt;&lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 18px;"&gt;
&lt;/SPAN&gt;&lt;SPAN style="color: #808080; border: 0px; font-weight: inherit; font-size: 18px;"&gt;// apply the new point to the graphic
&lt;/SPAN&gt;graphic.setGeometry(newPoint)&lt;SPAN style="color: #cc7832; border: 0px; font-weight: inherit; font-size: 18px;"&gt;;&lt;/SPAN&gt;&lt;/PRE&gt;&lt;P&gt;If this isn't what you are trying to achieve, then can you explain exactly what you are trying to implement.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 11 Dec 2021 15:12:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/arcgis-runtime-sdk-for-android-questions/update-graphic-on-graphic-layer-with-new-geo-point/m-p/320453#M2123</guid>
      <dc:creator>MarkBaird</dc:creator>
      <dc:date>2021-12-11T15:12:55Z</dc:date>
    </item>
  </channel>
</rss>

