Index: ui/android/java/src/org/chromium/ui/UiUtils.java |
diff --git a/ui/android/java/src/org/chromium/ui/UiUtils.java b/ui/android/java/src/org/chromium/ui/UiUtils.java |
index b81b994c9941fdfd4fb1bdf5d6bb91d59574cf1e..4522ec45677710936c72f75d01c1bc13776c7cff 100644 |
--- a/ui/android/java/src/org/chromium/ui/UiUtils.java |
+++ b/ui/android/java/src/org/chromium/ui/UiUtils.java |
@@ -333,4 +333,16 @@ public class UiUtils { |
? ContentUriUtils.getContentUriFromFile(context, file) |
: Uri.fromFile(file); |
} |
+ |
+ /** |
+ * Removes the view from its parent {@link ViewGroup}. No-op if the {@link View} is not yet |
+ * attached to the view hierarchy. |
+ * |
+ * @param view The view to be removed from the parent. |
+ */ |
+ public static void removeViewFromParent(View view) { |
+ ViewGroup parent = (ViewGroup) view.getParent(); |
+ if (parent == null) return; |
+ parent.removeView(view); |
+ } |
} |