title: ArcGis Map does not disapear in navigation Xamarin.Forms
body: <p>Hello guys :D I am having a problem with the android part of the Xamarin.Forms</p>
  
  <p>When I Navigate from a AbsoluteLayout with a Map and TabbleView (<a href="https://i.stack.imgur.com/xDf7y.png" rel="nofollow noreferrer">enter image description here</a>) to a Grid with only a Map, the Map from the previous page stays static on top of the second one(<a href="https://i.stack.imgur.com/WaEXa.png" rel="nofollow noreferrer">enter image description here</a>). This problem does not manifest in iOS, only in Android. If any of you guys know the problem please tell me so I can quickly fix :D</p>
  
  <p>Page with First Map</p>
  
  <pre><code>&lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
           xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
           x:Class="SGPI.Intervencao.CriarIntervencao"
           xmlns:local="clr-namespace:SGPI.Shared"
           xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
           Padding="5,5"&gt;
  &lt;ContentPage.Resources&gt;
      &lt;ResourceDictionary&gt;
          &lt;local:MapViewModel x:Key="MapViewModel" /&gt;
      &lt;/ResourceDictionary&gt;
  &lt;/ContentPage.Resources&gt;
  &lt;AbsoluteLayout&gt;
      &lt;esriUI:MapView Map="{Binding Map, Source={StaticResource MapViewModel}}" x:Name="map" AbsoluteLayout.LayoutBounds="0,0, 1, 0.6" AbsoluteLayout.LayoutFlags="All"/&gt;
      &lt;TableView Intent="Form" HasUnevenRows="True" AbsoluteLayout.LayoutBounds="0,1, 1, 0.4" AbsoluteLayout.LayoutFlags="All"&gt;
          &lt;TableRoot&gt;
              &lt;TableSection Title="Information"&gt;
                  &lt;EntryCell Label="Nome" Text="{Binding Name}" Placeholder="Nome"/&gt;
                  &lt;EntryCell Label="Codigo" Text="{Binding Code}" Placeholder="Codigo"/&gt;
                  &lt;ViewCell&gt;
                      &lt;StackLayout Orientation="Horizontal"&gt;
                          &lt;Label Text="Status" HorizontalOptions="Start" VerticalOptions="Center"/&gt;
                          &lt;Picker x:Name="pick" SelectedIndex="{Binding Index}" SelectedItem="{Binding Status}" Title="Status" HorizontalOptions="FillAndExpand"&gt;
                              &lt;Picker.Items&gt;
                                  &lt;x:String&gt;Em Construção&lt;/x:String&gt;
                                  &lt;x:String&gt;Construido&lt;/x:String&gt;
                              &lt;/Picker.Items&gt;
                          &lt;/Picker&gt;
                      &lt;/StackLayout&gt;
                  &lt;/ViewCell&gt;
                  &lt;ViewCell&gt;
                      &lt;Button Image="editMap.png" Clicked="Button_Clicked" /&gt;
                  &lt;/ViewCell&gt;
              &lt;/TableSection&gt;
          &lt;/TableRoot&gt;
      &lt;/TableView&gt;
  &lt;/AbsoluteLayout&gt;
  &lt;ContentPage.ToolbarItems&gt;
      &lt;ToolbarItem Icon="dan.png" Order="Primary" x:Name="done" Clicked="Done"/&gt;
  &lt;/ContentPage.ToolbarItems&gt;
  </code></pre>
  
  <p></p>
  
  <p>Code Behind</p>
  
  <pre><code>    using System;
      using System.Collections.Generic;
      using System.Collections.ObjectModel;
      using System.Linq;
      using System.Text;
      using System.Threading.Tasks;
  
  
       using Xamarin.Forms;
         using Xamarin.Forms.Xaml;
         namespace SGPI.Intervencao
  
     {
  
  
  
      [XamlCompilation(XamlCompilationOptions.Compile)]
      public partial class CriarIntervencao : ContentPage
      {
  
      public event EventHandler&lt;IntervencaoClass&gt; IntervencaoAdded;
      public event EventHandler&lt;IntervencaoClass&gt; IntervencaoUpdated;
  
          public CriarIntervencao(IntervencaoClass intervencao)
          {
  
              if(intervencao == null)
                  throw new ArgumentNullException(nameof(intervencao));
  
              InitializeComponent();
              BindingContext = new IntervencaoClass
              {
                  Code = intervencao.Code,
                  Name = intervencao.Name,
                  Status = intervencao.Status,
                  Index = intervencao.Index,
                  Id = intervencao.Id,
                  Polygons = intervencao.Polygons
              };
              if(intervencao.Polygons != null)
                  map.GraphicsOverlays.Add(intervencao.Polygons);
          }
  
          private async void Done(object sender, EventArgs e)
           {
              var intervencao = BindingContext as IntervencaoClass;
              if (filled())
              {
                  await DisplayAlert("Erro", "Preenche tudo", "OK");
                  return;
              }
              map.GraphicsOverlays.Clear();
              if (!intervencao.Id.HasValue)
              {
                  intervencao.Id = 1;
                  IntervencaoAdded?.Invoke(this, intervencao);
              }
              else
              {
                  IntervencaoUpdated?.Invoke(this, intervencao);
              }
  
              await Navigation.PopAsync();
          }
  
          public bool filled()
          {
              var intervencao = BindingContext as IntervencaoClass;
              return String.IsNullOrEmpty(intervencao.Name) || String.IsNullOrEmpty(intervencao.Code) || pick.SelectedIndex == -1;
          }
  
          private async void Button_Clicked(object sender, EventArgs e)
          {
              map.GraphicsOverlays.Clear();
              var page = new MapPages.MapPage((BindingContext as IntervencaoClass).Polygons);
              page.AcceptedMap += (send, graphics) =&gt; {
                  var intervencao = BindingContext as IntervencaoClass;
                  intervencao.Polygons = graphics;
                  map.GraphicsOverlays.Add(graphics);
                  Navigation.PopAsync();
              };
              await Navigation.PushAsync(page);
          }
  
      }
  }
  </code></pre>
  
  <p>Second Page</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8" ?&gt;
  &lt;ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
               xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
               xmlns:local="clr-namespace:SGPI.Shared"
               xmlns:esriUI="clr-namespace:Esri.ArcGISRuntime.Xamarin.Forms;assembly=Esri.ArcGISRuntime.Xamarin.Forms"
               x:Class="SGPI.MapPages.MapPage"&gt;
      &lt;ContentPage.Resources&gt;
          &lt;ResourceDictionary&gt;
              &lt;local:MapViewModel x:Key="MapViewModel" /&gt;
          &lt;/ResourceDictionary&gt;
      &lt;/ContentPage.Resources&gt;
      &lt;Grid&gt;
              &lt;esriUI:MapView Map="{Binding Map, Source={StaticResource MapViewModel}}" x:Name="map" GeoViewTapped="Map_GeoViewTapped"/&gt;
      &lt;/Grid&gt;
      &lt;ContentPage.ToolbarItems&gt;
          &lt;ToolbarItem Icon="dan.png" Clicked="Done"/&gt;
      &lt;/ContentPage.ToolbarItems&gt;
  &lt;/ContentPage&gt;
  </code></pre>
  
  <p>Second Page Code Behind</p>
  
  <pre><code>using Esri.ArcGISRuntime.Data;
  using Esri.ArcGISRuntime.Geometry;
  using Esri.ArcGISRuntime.Symbology;
  using System.Collections.Generic;
  using Xamarin.Forms;
  using Esri.ArcGISRuntime.UI;
  using System;
  using System.Threading;
  
  namespace SGPI.MapPages
  {
      public partial class MapPage : ContentPage
      {
  
          public event EventHandler&lt;GraphicsOverlay&gt; AcceptedMap;
          List&lt;MapPoint&gt; points;
          static SimpleLineSymbol symbol = new SimpleLineSymbol()
          {
              Style = SimpleLineSymbolStyle.Dash,
              Color = System.Drawing.Color.Black,
              Width = 1
          };
          static SimpleMarkerSymbol marker = new SimpleMarkerSymbol()
          {
              Color = System.Drawing.Color.Pink,
              Outline = symbol,
              Style = SimpleMarkerSymbolStyle.Diamond,
              Size = 10
          };
          static SimpleLineSymbol line = new SimpleLineSymbol(SimpleLineSymbolStyle.Solid, System.Drawing.Color.CadetBlue, 1);
          static SimpleFillSymbol fill = new SimpleFillSymbol(SimpleFillSymbolStyle.Solid, System.Drawing.Color.Black, line);
  
          public MapPage(GraphicsOverlay graphic)
          {
              InitializeComponent();
              map.Map = new SGPI.Shared.MapViewModel().Map;
              if(graphic == null)
                  graphic = new GraphicsOverlay();
              map.GraphicsOverlays.Add(graphic);
              points = new List&lt;MapPoint&gt;();
          }
  
  
  
          private Graphic AddPolygonInMap(MapPoint[] points)
          {
              var pointCollection = new PointCollection(points[0].SpatialReference);
              foreach (MapPoint p in points)
                  pointCollection.Add(p);
  
              var sPolygon = new Polygon(pointCollection);
  
              return new Graphic(sPolygon, fill);
          }
  
          private void AddPointinMap(MapPoint point)
          {
              Graphic graphic = new Graphic(point, marker);
              map.GraphicsOverlays[0].Graphics.Add(graphic);
          }
  
  
          private async void Map_GeoViewTapped(object sender, Esri.ArcGISRuntime.Xamarin.Forms.GeoViewInputEventArgs e)
          {
              var tolerance = 10d; // Use larger tolerance for touch
              var maximumResults = 1; // Only return one graphic  
              var onlyReturnPopups = false; // Don't return only popups
  
              // Use the following method to identify graphics in a specific graphics overlay
              IdentifyGraphicsOverlayResult identifyResults = await map.IdentifyGraphicsOverlayAsync(
                   map.GraphicsOverlays[0],
                   e.Position,
                   tolerance,
                   onlyReturnPopups,
                   maximumResults);
  
              // Check if we got results
              if (identifyResults.Graphics.Count &gt; 0)
              {
                  // Make sure that the UI changes are done in the UI thread
                  Device.BeginInvokeOnMainThread(async () =&gt; {
                      await DisplayAlert("", "Tapped on graphic", "OK");
                  });
              } else
              {
                  points.Add(e.Location);
                  AddPointinMap(e.Location);
              }
          }
  
      private async void Done(object sender, EventArgs e)
          {
              if(points.Count &gt; 2) { 
                  GraphicsOverlay graphics = new GraphicsOverlay();
                  graphics.Graphics.Add(AddPolygonInMap(points.ToArray()));
                  map.GraphicsOverlays.Add(graphics);
                  Thread.Sleep(500);
                  var accepted = await DisplayAlert("Aviso", "Este é o polígono certo?", "Sim", "Não");
                  if (accepted)
                  {
                      GraphicsOverlay graph = graphics;
                      map.GraphicsOverlays.Clear();
                      AcceptedMap?.Invoke(this, graph);
                  }
                  else
                  {
                      for(int i = 1; i &lt; map.GraphicsOverlays.Count; i++)
                          map.GraphicsOverlays[i] = new GraphicsOverlay();
                  }
              }
          }
      }
  }
  </code></pre>