I use API Level 16, in i try to replace some Fragment below some Tab where already is some Fragment. I cant really find a reason why, but sometimes i get an Exception like this:
E/AndroidRuntime(27395): java.lang.NullPointerException
E/AndroidRuntime(27395): at android.app.BackStackRecord.run(BackStackRecord.java:604)
E/AndroidRuntime(27395): at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1399)
E/AndroidRuntime(27395): at android.app.FragmentManagerImpl$1.run(FragmentManager.java:426)
E/AndroidRuntime(27395): at android.os.Handler.handleCallback(Handler.java:615)
E/AndroidRuntime(27395): at android.os.Handler.dispatchMessage(Handler.java:92)
E/AndroidRuntime(27395): at android.os.Looper.loop(Looper.java:137)
E/AndroidRuntime(27395): at android.app.ActivityThread.main(ActivityThread.java:4921)
E/AndroidRuntime(27395): at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(27395): at java.lang.reflect.Method.invoke(Method.java:511)
E/AndroidRuntime(27395): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1038)
E/AndroidRuntime(27395): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:805)
E/AndroidRuntime(27395): at dalvik.system.NativeStart.main(Native Method)
I do not add an null Fragment and code running there is simple:
final Fragment newFragment = Fragment.instantiate(anContext, clazz.getName(), arguments);
final FragmentTransaction transaction = manager.beginTransaction();
transaction.disallowAddToBackStack();
transaction.replace(R.id.fragment_content_center, newFragment);
transaction.commit();
If you like, have a look on Grepcode, as there the Exception happens: http://grepcode.com/file/repository.grepcode.com/java/ext/com.google.android/android/4.1.2_r1/android/app/BackStackRecord.java#604
Im not using any Animations there.