getParentFragment() was introduced in API level 17 (Android 4.2). Android 4.2 introduced the idea of nested fragments (fragments containing other fragments). Calling this results in null if the fragment has a parent which is an Activity.
Have a look at this.
If you are using support library then you can use getParent(), may be you need to use getChildFragmentManager() while doing fragment transaction.
See this
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…