private boolean areViewsIdentical(View firstView, View secondView){
		if(firstView.getId() != secondView.getId() || !firstView.getClass().isAssignableFrom(secondView.getClass())){
			return false;
		}

		if (firstView.getParent() != null && firstView.getParent() instanceof View && 
				secondView.getParent() != null && secondView.getParent() instanceof View) {

			return areViewsIdentical((View) firstView.getParent(), (View) secondView.getParent());
		} else {
			return true;
		}
	}
private boolean areViewsIdentical ( View firstView , View secondView ) { if ( firstView . getId ( ) != secondView . getId ( ) || ! firstView . getClass ( ) . isAssignableFrom ( secondView . getClass ( ) ) ) { return false ; } if ( firstView . getParent ( ) != null && firstView . getParent ( ) instanceof View && secondView . getParent ( ) != null && secondView . getParent ( ) instanceof View ) { return areViewsIdentical ( ( View ) firstView . getParent ( ) , ( View ) secondView . getParent ( ) ) ; } else { return true ; } }
Compares if the specified views are identical. This is used instead of View.compare
as it always returns false in cases where the View tree is refreshed.

@param firstView the first view
@param secondView the second view
@return true if views are equal