I am using actionbar in which it has tabs, each tab is a fragment. Everything is great except when I do fast switching between the tabs. When I do fast switching, I get this bug:
java.lang.IllegalStateException: Recursive entry to executePendingTransactions
at android.support.v4.app.FragmentManagerImpl.execPendingActions(Unknown Source)
at android.support.v4.app.FragmentManagerImpl$1.run(Unknown Source)
at android.os.Handler.handleCallback(Handler.java:615)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
Here is my code for OnTapSelected
if (mFragment == null) {
mFragment = (SherlockFragment) SherlockFragment.instantiate(mActivity, mClass.getName(), mArgs);
ft.add(android.R.id.content, mFragment, mTag);
} else {
ft.attach(mFragment);
}
Any way I can fix this? Or if not , how can I at least catch this exception (like where to put the try/catch) so my app does not get crashed?
thank you
instead of using attach, try using show/hide. you will need references to all of your fragments, but if you add them all, then show the right one and hide the rest that might fix it.