From 8d2520bd7c877339983621904427bac3b77b93d9 Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Tue, 24 May 2022 12:38:35 +0100 Subject: [PATCH] Revert "Fix crash removing items in ListView (#7411)" (#7418) This reverts commit 4b64fd9d70b2b1e303dc3c189c1db282e7b1392f. --- src/Core/src/Handlers/Layout/LayoutHandler.Android.cs | 2 +- src/Core/src/Platform/Android/ViewGroupExtensions.cs | 8 -------- 2 files changed, 1 insertion(+), 9 deletions(-) diff --git a/src/Core/src/Handlers/Layout/LayoutHandler.Android.cs b/src/Core/src/Handlers/Layout/LayoutHandler.Android.cs index 84f59759f432..8c23875d2d62 100644 --- a/src/Core/src/Handlers/Layout/LayoutHandler.Android.cs +++ b/src/Core/src/Handlers/Layout/LayoutHandler.Android.cs @@ -40,7 +40,7 @@ public override void SetVirtualView(IView view) foreach (var child in VirtualView.OrderByZIndex()) { - PlatformView.SafelyAddView(child.ToPlatform(MauiContext)); + PlatformView.AddView(child.ToPlatform(MauiContext)); } } diff --git a/src/Core/src/Platform/Android/ViewGroupExtensions.cs b/src/Core/src/Platform/Android/ViewGroupExtensions.cs index b8bc13aef2df..8940e5585173 100644 --- a/src/Core/src/Platform/Android/ViewGroupExtensions.cs +++ b/src/Core/src/Platform/Android/ViewGroupExtensions.cs @@ -6,14 +6,6 @@ namespace Microsoft.Maui.Platform { public static class ViewGroupExtensions { - public static void SafelyAddView(this AViewGroup viewGroup, AView child) - { - if (child.Parent != null) - child.RemoveFromParent(); - - viewGroup.AddView(child); - } - public static IEnumerable GetChildrenOfType(this AViewGroup viewGroup) where T : AView { for (var i = 0; i < viewGroup.ChildCount; i++)