@Test public void removeFromParent_withMultipleChildren_shouldRemoveCorrectChild() throws Exception { parent.addView(new TextView(context)); assertThat(parent.getChildCount()).isEqualTo(1); parent.addView(subject); assertThat(parent.getChildCount()).isEqualTo(2); Views.removeFromParent(subject); assertThat(parent.getChildCount()).isEqualTo(1); assertThat(parent.getChildAt(0)).isInstanceOf(TextView.class); }
public static void removeFromParent(View view) { if (view == null || view.getParent() == null) { return; } if (view.getParent() instanceof ViewGroup) { ((ViewGroup) view.getParent()).removeView(view); } }
Views { public static void removeFromParent(View view) { if (view == null || view.getParent() == null) { return; } if (view.getParent() instanceof ViewGroup) { ((ViewGroup) view.getParent()).removeView(view); } } }
Views { public static void removeFromParent(View view) { if (view == null || view.getParent() == null) { return; } if (view.getParent() instanceof ViewGroup) { ((ViewGroup) view.getParent()).removeView(view); } }  }
Views { public static void removeFromParent(View view) { if (view == null || view.getParent() == null) { return; } if (view.getParent() instanceof ViewGroup) { ((ViewGroup) view.getParent()).removeView(view); } }  static void removeFromParent(View view); }
Views { public static void removeFromParent(View view) { if (view == null || view.getParent() == null) { return; } if (view.getParent() instanceof ViewGroup) { ((ViewGroup) view.getParent()).removeView(view); } }  static void removeFromParent(View view);  }