Skip to content Skip to sidebar Skip to footer

In Actionbar Sherlock, Add Tab Throw: Commit Already Called

I'm trying to use ActionBarSherlock for tab view in android. It's only a demo project with 3 tabs, each tab just show a fragment which contains a textview. This is my MainActivityc

Solution 1:

I know this is a old question but since no answer is given, here it is. Change:

@OverridepublicvoidonTabSelected(Tab tab, FragmentTransaction ft) {
    Log.e("Listener", "onTabSelected");
    ft.replace(resId, mFragment).commit();
}

To

@OverridepublicvoidonTabSelected(Tab tab, FragmentTransaction ft) {
    Log.e("Listener", "onTabSelected");
    ft.replace(resId, mFragment);
}

The FragmentTransaction will automatically get commited, thus explicitely calling .commit() will throw the error you encounter.

Post a Comment for "In Actionbar Sherlock, Add Tab Throw: Commit Already Called"