diff --git a/lib/src/main/java/com/nhaarman/supertooltips/ToolTipView.java b/lib/src/main/java/com/nhaarman/supertooltips/ToolTipView.java index eb6e3cd..afda290 100644 --- a/lib/src/main/java/com/nhaarman/supertooltips/ToolTipView.java +++ b/lib/src/main/java/com/nhaarman/supertooltips/ToolTipView.java @@ -102,7 +102,9 @@ public boolean onPreDraw() { RelativeLayout.LayoutParams layoutParams = (RelativeLayout.LayoutParams) getLayoutParams(); layoutParams.width = mWidth; setLayoutParams(layoutParams); - + if (getParent() == null) { + return false; + } if (mToolTip != null) { applyToolTipPosition(); } @@ -152,7 +154,9 @@ private void applyToolTipPosition() { mView.getWindowVisibleDisplayFrame(viewDisplayFrame); final int[] parentViewScreenPosition = new int[2]; - ((View) getParent()).getLocationOnScreen(parentViewScreenPosition); + if (getParent() != null) { + ((View) getParent()).getLocationOnScreen(parentViewScreenPosition); + } final int masterViewWidth = mView.getWidth(); final int masterViewHeight = mView.getHeight();