Code example for ViewParent

Methods: getParent

   * @param view the view whose parent to return 
   * @return the parent of {@code view}, or {@code null} if it has no parent 
  protected ViewParent getViewParent(ViewParent view) {
    return view.getParent();
   * Tests if the first {@code View} is the same as, or somewhere inside the 
   * {@code View} hierarchy of, the second {@code View}. 
  public boolean viewIsSameOrDescendant(View child, View parent) {
    if (child == parent) {
      return true; 
    ViewParent middleParent = getViewParent(child);