getView(i).setParent(null);
{ View child = getView(i);    if (child.getParent() == this) child.setParent(null); }
  public void setParent(View parent)  {    if (parent == null)      {        int numChildren = getViewCount();        for (int i = 0; i < numChildren; i++)          getView(i).setParent(null);      }    this.parent = parent;  }