<?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: Navigation between 2 MapViews in Xamarin Android in .NET Maps SDK Questions</title>
    <link>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568108#M6971</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been experiencing the same or similar issue.&lt;/P&gt;&lt;P&gt;I have two pages, both containing map controls with different maps connected to them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It woks as expected on iOS and UWP but on Android its as described. On the second page to be display the map never loads and doesn't respond to touch actions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my design the two pages are switched between using a master detail page. I'm using runtime version 100.1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated, I have tried setting both pages maps to null before leaving, it had not effect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 15 Aug 2017 22:31:55 GMT</pubDate>
    <dc:creator>BrianMarchionni1</dc:creator>
    <dc:date>2017-08-15T22:31:55Z</dc:date>
    <item>
      <title>Navigation between 2 MapViews in Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568105#M6968</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm working on mobile app (Xamarin Android and iOS) for our company and I need to navigate between two pages, each with MapView object. It's kind of "Master-Detail" scenario, I display some basic information about tapped location in first screen, but there is a "More Info" button to show more information about area. When user tap the button, app navigates to second page with smaller MapView, different map layer and some metadata about area.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This works well on iOS, but when I tested it on Android (different api versions, from android 4.4 to 7.0), the MapView on second page did not show up, instead there is some "cache" from previous page. I cannot pan or zoom, but tap event fires just like it should.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Please see attached screens for details.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ios (correct rendering):&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="354353" alt="iOS master page" class="image-1 jive-image" src="https://community.esri.com/legacyfs/online/354353_i-01.png" style="width: 338px; height: 600px;" /&gt;&amp;nbsp;&lt;IMG __jive_id="354354" alt="iOS detail page" class="image-2 jive-image" src="https://community.esri.com/legacyfs/online/354354_i-02.png" style="width: 338px; height: 600px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Android (broken rendering)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;IMG __jive_id="354355" alt="Android Master Page" class="image-3 jive-image" src="https://community.esri.com/legacyfs/online/354355_a-01.png" style="width: 338px; height: 601px;" /&gt;&amp;nbsp;&lt;IMG __jive_id="354356" alt="Android Detail Page" class="image-4 jive-image" src="https://community.esri.com/legacyfs/online/354356_a-02.png" style="width: 338px; height: 601px;" /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any idea what's wrong? Thanks for answer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 29 May 2017 11:23:46 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568105#M6968</guid>
      <dc:creator>AndrejMelicher</dc:creator>
      <dc:date>2017-05-29T11:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Navigation between 2 MapViews in Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568106#M6969</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Are you reusing the map and layers in the second mapview? Make sure the Map is unhooked and removed from the previous mapview before reusing it in another mapview, as it's not a sharable object. One way to do this is to set the MapView.Map property to null when leaving the master page before moving to the detail page (and same for navigating back)&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 31 May 2017 17:56:53 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568106#M6969</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2017-05-31T17:56:53Z</dc:date>
    </item>
    <item>
      <title>Re: Navigation between 2 MapViews in Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568107#M6970</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thanks for answer. If I remove Map from MapView, I get empty MapView with Grids on DetailPage. Just the same as it is on MasterPage.&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 02 Jun 2017 09:55:27 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568107#M6970</guid>
      <dc:creator>AndrejMelicher</dc:creator>
      <dc:date>2017-06-02T09:55:27Z</dc:date>
    </item>
    <item>
      <title>Re: Navigation between 2 MapViews in Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568108#M6971</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I've been experiencing the same or similar issue.&lt;/P&gt;&lt;P&gt;I have two pages, both containing map controls with different maps connected to them.&amp;nbsp;&lt;/P&gt;&lt;P&gt;It woks as expected on iOS and UWP but on Android its as described. On the second page to be display the map never loads and doesn't respond to touch actions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In my design the two pages are switched between using a master detail page. I'm using runtime version 100.1&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Any help would be appreciated, I have tried setting both pages maps to null before leaving, it had not effect.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Aug 2017 22:31:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568108#M6971</guid>
      <dc:creator>BrianMarchionni1</dc:creator>
      <dc:date>2017-08-15T22:31:55Z</dc:date>
    </item>
    <item>
      <title>Re: Navigation between 2 MapViews in Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568109#M6972</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Any chance either of you could share a reproducer so we can have a look?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Aug 2017 18:19:04 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568109#M6972</guid>
      <dc:creator>dotMorten_esri</dc:creator>
      <dc:date>2017-08-16T18:19:04Z</dc:date>
    </item>
    <item>
      <title>Re: Navigation between 2 MapViews in Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568110#M6973</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Morten, I've made an example. You'll note MapTwo never loads on Android but it does on the other systems. If you've got any suggestions or work around I'd really appreciate it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://s000.tinyupload.com/index.php?file_id=73617624231853711381" title="http://s000.tinyupload.com/index.php?file_id=73617624231853711381"&gt;TinyUpload.com - best file hosting solution, with no limits, totaly free&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 16 Aug 2017 20:08:11 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568110#M6973</guid>
      <dc:creator>BrianMarchionni1</dc:creator>
      <dc:date>2017-08-16T20:08:11Z</dc:date>
    </item>
    <item>
      <title>Re: Navigation between 2 MapViews in Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568111#M6974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Brian,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The issue can be worked around by removing the MapView from the visual tree when a page is hidden and re-adding it when the page is shown. &amp;nbsp;In a content page, you can do that as follows:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#if __ANDROID__ // We don't need this workaround&amp;nbsp;on other platforms, so limit it to Android&lt;/P&gt;&lt;P&gt;protected override void OnAppearing()&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if (!RootLayout.Children.Contains(_mapView))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RootLayout.Children.Add(_mapView);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; base.OnAppearing();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;protected override void OnDisappearing()&lt;BR /&gt;{&lt;BR /&gt;&amp;nbsp; &amp;nbsp; if (RootLayout.Children.Contains(_mapView))&lt;BR /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; RootLayout.Children.Remove(_mapView);&lt;BR /&gt;&amp;nbsp; &amp;nbsp; base.OnDisappearing();&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;#endif&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"RootLayout" in the code above would be the UI element that contains the MapView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The basic problem here is that Xamarin Forms' navigation stack appears to render pages one on top of another, rather than one keeping one page in the visual tree at a time. &amp;nbsp;That leads to the issue you're seeing because there is problem&amp;nbsp;with our MapView (and SceneView) where rendering overlapping views does not work properly on Android.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-Rich&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 17 Aug 2017 14:37:38 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568111#M6974</guid>
      <dc:creator>RichZwaap</dc:creator>
      <dc:date>2017-08-17T14:37:38Z</dc:date>
    </item>
    <item>
      <title>Re: Navigation between 2 MapViews in Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568112#M6975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This works for removing the map, however when I add it back in I get an error "Cannot add a null child to a ViewGroup".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anybody know what may be causing that? &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The exception is at this line:&lt;/P&gt;&lt;P&gt;MapGrid.Children.Add(MyDetailMapView);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Whereas MapGrid is a Xamarin Forms Grid which is the Content of my ContentPage, and MyDetailMapView is an ArcGIS MapView. &amp;nbsp;The MapView is not null when I attempt to add, nor is the Grid itself. &amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I copy the code above exactly and just changed RootLayout to my Grid and _mapView to my MapView.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Aug 2017 00:22:09 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568112#M6975</guid>
      <dc:creator>AlejandroSegura</dc:creator>
      <dc:date>2017-08-29T00:22:09Z</dc:date>
    </item>
    <item>
      <title>Re: Navigation between 2 MapViews in Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568113#M6976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;This is not a solution...when you remove the MapView from the UI it cannot be re-added.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;According to this Certified Xamarin Developer at least:&amp;nbsp;&lt;A class="link-titled" href="https://forums.xamarin.com/discussion/102169/error-cannot-add-a-null-child-view-to-a-viewgroup#latest" title="https://forums.xamarin.com/discussion/102169/error-cannot-add-a-null-child-view-to-a-viewgroup#latest"&gt;Error: Cannot add a null child view to a ViewGroup — Xamarin Forums&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Did anybody actually get this to work? &amp;nbsp;How? &amp;nbsp;I use the exact code and the MapView cannot be re-added to the grid after it's been removed. &amp;nbsp;Furthermore I tried it in another way. &amp;nbsp;I don't even navigate to another page I just have a button that removes the MapView if it exists in the Grid content, and adds it back if it doesn't exist. &amp;nbsp;It fails everytime with the same error "Cannot add a null child view to a ViewGroup". &amp;nbsp;The object shows it exists in the debugger, but Xamarin says it cannot be added. &amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Sep 2017 23:05:55 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568113#M6976</guid>
      <dc:creator>AlejandroSegura</dc:creator>
      <dc:date>2017-09-07T23:05:55Z</dc:date>
    </item>
    <item>
      <title>Re: Navigation between 2 MapViews in Xamarin Android</title>
      <link>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568114#M6977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alejandro,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Here is the exact code/markup that I use in my project and it works. To avoid having the MapView added back to the view at a random spot I put it is a StackLayout which guarantees its always going back&amp;nbsp;where it was originally. You may need to save a reference to the _mapView object in the OnDisappearing() event but I didn't need to.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;lt;!-- &amp;nbsp;PART 3/3 of fix for esriUI:MapView never loading on Android see OnAppearing() &amp;nbsp;--&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;lt;StackLayout x:Name="_mapContainer"&lt;BR /&gt; AbsoluteLayout.LayoutBounds="0,0,1,1"&lt;BR /&gt; AbsoluteLayout.LayoutFlags="All"&amp;gt;&lt;BR /&gt; &amp;lt;esriUI:MapView x:Name="_mapView"&lt;BR /&gt; HorizontalOptions="FillAndExpand"&lt;BR /&gt; Map="{Binding Map}"&lt;BR /&gt; VerticalOptions="FillAndExpand"/&amp;gt;&lt;BR /&gt; &amp;lt;/StackLayout&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;protected override void OnAppearing()&lt;BR /&gt; {&lt;BR /&gt; // PART 1/3 of Fix for second ESRI never loading on Android&lt;BR /&gt;#if __ANDROID__&lt;BR /&gt; if (_mapContainer.Children.Contains(_mapView) == false)&lt;BR /&gt; _mapContainer.Children.Add(_mapView);&lt;BR /&gt;#endif&lt;/P&gt;&lt;P&gt;base.OnAppearing();&lt;BR /&gt; }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;protected override void OnDisappearing()&lt;BR /&gt; {&lt;BR /&gt; // PART 2/3 of Fix for second ESRI never loading on Android&lt;BR /&gt;#if __ANDROID__&lt;BR /&gt; if (_mapContainer.Children.Contains(_mapView))&lt;BR /&gt; _mapContainer.Children.Remove(_mapView);&lt;BR /&gt;#endif&lt;BR /&gt; base.OnDisappearing();&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope this helps&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Brian&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Sep 2017 15:59:06 GMT</pubDate>
      <guid>https://community.esri.com/t5/net-maps-sdk-questions/navigation-between-2-mapviews-in-xamarin-android/m-p/568114#M6977</guid>
      <dc:creator>BrianMarchionni1</dc:creator>
      <dc:date>2017-09-08T15:59:06Z</dc:date>
    </item>
  </channel>
</rss>

