I have an ArcGIS MapView in a page. In Android there is some bug where you have to remove the MapView from the UI when navigating to a new page, and add it back when you come back to your page...otherwise the map shows up on the page where it shouldn't and it blocks everything.
See here: https://geonet.esri.com/thread/195773-navigation-between-2-mapviews-in-xamarin-android
My issue is that I took their advice yet when I go to add the MapView back to the Grid I get this error "Cannot add a null child view to a ViewGroup".
The Map is removed from the subsequent page as expected, however when I PopModalAsync and try to re-add the map it throws the error.
During debugging neither my MapView nor my Grid are null. Any ideas on what I'm doing wrong?
MapGrid is a Xamarin Forms Grid which is set to the Content of my ContentPage. MyDetailMapView is an ArcGIS MapView which contains the map. The MapGrid contains MyDetailMapView and a ScrollStack.
Code here (could not get the format ticks to work right...sorry):
`protected override void OnAppearing()
{
if (!MapGrid.Children.Contains(MyDetailMapView))
{
MapGrid.Children.Add(MyDetailMapView); // <---- Exception is thrown here
}
base.OnAppearing();
}
protected override void OnDisappearing()
{
if (MapGrid.Children.Contains(MyDetailMapView))
MapGrid.Children.Remove(MyDetailMapView);
base.OnDisappearing();
}
`