From 166ebd4da5d85195bd1f562572f468726ade548f Mon Sep 17 00:00:00 2001 From: Adam Cohen Date: Tue, 26 Nov 2013 14:55:45 -0800 Subject: [PATCH] De-parent custom content view before adding to custom content screen Bug: 11666352 Change-Id: Ief35e6e8a16ec0217e0dd27434723ee7a7d5beef --- src/com/android/launcher3/Workspace.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java index b1b50bf5ea..02949e7dd9 100644 --- a/src/com/android/launcher3/Workspace.java +++ b/src/com/android/launcher3/Workspace.java @@ -619,6 +619,12 @@ public class Workspace extends SmoothPagedView if (customContent instanceof Insettable) { ((Insettable)customContent).setInsets(mInsets); } + + // Verify that the child is removed from any existing parent. + if (customContent.getParent() instanceof ViewGroup) { + ViewGroup parent = (ViewGroup) customContent.getParent(); + parent.removeView(customContent); + } customScreen.removeAllViews(); customScreen.addViewToCellLayout(customContent, 0, 0, lp, true); mCustomContentDescription = description;