java.lang.NullPointerException: Attempt to read from field 'int android.support.v4.app.Fragment.mContainerId' on a null object reference
at android.support.v4.app.FragmentTransition.addToFirstInLastOut(FragmentTransition.java:1017)
at android.support.v4.app.FragmentTransition.calculatePopFragments(FragmentTransition.java:996)
at android.support.v4.app.FragmentTransition.startTransitions(FragmentTransition.java:93)
at android.support.v4.app.FragmentManagerImpl.executeOpsTogether(FragmentManager.java:2146)
at android.support.v4.app.FragmentManagerImpl.optimizeAndExecuteOps(FragmentManager.java:2103)
at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:2013)
at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:710)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6126)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
I have one activity a navigation drawer with fragments handling the views, my transitions and such work fine until i start rotating then i get that. Note: The rotation works fine upon first visit but when go away then return to the fragment > rotate > select other fragment in navi drawer it crashes. please advice would be great!
here is some more code:
Fragment currentFrag = getSupportFragmentManager().findFragmentById(R.id.newsfeedContainer);
if (currentFrag instanceof NewsFeedFragment) {
result.closeDrawer();
} else {
if (newsFeedFragment != null) {
getSupportFragmentManager().popBackStack(null, POP_BACK_STACK_INCLUSIVE);
transaction.show(newsFeedFragment);
transaction.addToBackStack("newsfeed");
transaction.commit();
}
}
result.closeDrawer();
} this is part my navigation drawer.. when this item is selected it works.. but when I open another fragment and come back to the previous fragment AND ROTATE it gives a nullpointer