2

I've got an Activity with a custom sliding menu for a tab-like interface. For some reason, one (and only one) of my fragments has this error and I can't seem to find what it's doing.

Here is the stack trace.

E/FragmentManager(13024): Failure saving state: active SettingsFragment{427b2918} has cleared index: -1
E/FragmentManager(13024): Activity state:
E/AndroidRuntime(13024): FATAL EXCEPTION: main
E/AndroidRuntime(13024): java.lang.IllegalStateException: Failure saving state: active SettingsFragment{427b2918} has cleared index: -1
E/AndroidRuntime(13024):    at android.support.v4.app.FragmentManagerImpl.saveAllState(FragmentManager.java:1700)
E/AndroidRuntime(13024):    at android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:527)
E/AndroidRuntime(13024):    at com.actionbarsherlock.app.SherlockFragmentActivity.onSaveInstanceState(SherlockFragmentActivity.java:127)
E/AndroidRuntime(13024):    at com.slidingmenu.lib.app.SlidingFragmentActivity.onSaveInstanceState(SlidingFragmentActivity.java:50)
E/AndroidRuntime(13024):    at com.client.activities.BaseMenuActivity.onSaveInstanceState(BaseMenuActivity.java:139)

The fragment is super simple. All it does is subclass SherlockFragment and override onCreateView and onActivityCreated to setup the view. It's got some buttons that navigate to other fragments.

I can't even reliably reproduce this error. Any ideas?

rharter
  • 2,495
  • 18
  • 34

1 Answers1

0

in this case i Guess when you want to attach you're fragment , it seen like my code

       case 2:
            ft.replace(R.id.content_frame, **xxxx**, "2");
            ft.detach(**yyyyyyy**);
            ft.attach(**yyyyyyy**);

code below is wrong and correct code is

         case 2:
            ft.replace(R.id.content_frame, **xxxx**, "2");
            ft.detach(**xxxx**);
            ft.attach(**xxxx**);

maybe you have error like this and i hope it be helpful for you

tohid
  • 119
  • 1
  • 7