Code example for ViewParent

Methods: getParent

2
	public ViewGroup getParentFliper(View view) {
		if (view.getParent() instanceof BaseRealViewSwitcher) {
			return (ViewGroup) view.getParent();
		} else { 
			ViewParent parentView = view.getParent();
			if (parentView != null && parentView.getParent() == null)
				return null; 
			else 
				return getParentFliper((View) parentView);
		} 
 
	} 
 
	private void snapToDestination() { 
 
		final int screenWidth = getWidth();
		// int whichScreen = (getScrollX() + (screenWidth / 5) * 4) / 
		// screenWidth; 
		int whichScreen = 0;
		boolean isOnRight = getScrollX() > screenWidth * mCurrentScreen;
		boolean limitToSnap = Math.abs(getScrollX() - screenWidth