In my application I have one Activity, which consists of an overlaying side panel (navigation menu) and a LinearLayout, which is my main layout. I do transactions on my layout and replace fragments inside. I'm only allowing the user to navigate forward so I do not use a backstack at all. Instead, I use a Hashmap (a pseudo-cache) to keep the fragment instances in memory as the user navigates forward in the menu. The only problem with this approach is that I keep getting a crash when I try to replace the fragment that's currently in the main layout with a fragment from the cache (I ran it through the debugger and it says that the FragmentTransaction.replace() method check's the backstack(??)). I'm not quite sure what the issue is.
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): FATAL EXCEPTION: main
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): java.lang.IllegalStateException: Fragment already added: GuideFragment{409f2fd8 id=0x7f06008c}
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at android.app.BackStackRecord.doAddOp(BackStackRecord.java:322)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at android.app.BackStackRecord.replace(BackStackRecord.java:360)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at android.app.BackStackRecord.replace(BackStackRecord.java:352)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at StartActivity.changeContent(StartActivity.java:194)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at StartActivity$5.onClick(StartActivity.java:165)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at android.view.View.performClick(View.java:3117)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at android.view.View$PerformClick.run(View.java:11935)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at android.os.Handler.handleCallback(Handler.java:587)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at android.os.Handler.dispatchMessage(Handler.java:92)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at android.os.Looper.loop(Looper.java:132)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at android.app.ActivityThread.main(ActivityThread.java:4025)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at java.lang.reflect.Method.invokeNative(Native Method)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at java.lang.reflect.Method.invoke(Method.java:491)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:841)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:599)
07-25 22:03:47.690: ERROR/AndroidRuntime(3141): at dalvik.system.NativeStart.main(Native Method)