There's a solution in stackoverflow: http://stackoverflow.com/questions/11296411/fragmentstatepageradapter-illegalstateexception-myfragment-is-not-currently
but it doesn't seem to be helping me, since I'm not instantiating my fragments as he did, but maybe it'll help you. I'm still looking for a solution for myself. On Thursday, June 14, 2012 10:34:05 AM UTC+3, Alexandros wrote: > > Someone please? > > On Sunday, June 3, 2012 10:50:33 AM UTC+3, Alexandros wrote: >> >> Hello everyone, >> >> Some time ago, I updated my application to use the support v4 library in >> order to use the ViewPager control. The initial version of the application >> used the FragmentPagerAdapter, however, because the application has a lot >> of pages it seemed wise to use the FragmentStatePagerAdapter, since I was >> getting OutOfMemory reports. But now, I am getting reports of another >> error. The error is: java.lang.IllegalStateException: Fragment >> <MyFragment> is not currently in the FragmentManager. >> I did some searching on the Internet, but nothing solid came up. The >> problem seems to be happening when the activity is trying to pause and the >> onSaveInstanceState method is called. After I did some investigation on the >> support v4 library my self, I noticed that this exception is thrown in the >> FragmentManager.putFragment() when the member of the fragment mIndex is >> less than 0, but I cannot figure out when mIndex becomes less than 0 and >> why this is not handled correctly. >> >> *I would like to point out that I do not have an MOR (method of >> reproduction) for this error.* >> >> Here is the call stack: >> java.lang.RuntimeException: Unable to pause activity <my activity with >> the ViewPager> java.lang.IllegalStateException: Fragment <MyFragment> is >> not currently in the FragmentManager >> at >> android.app.ActivityThread.performPauseActivity(ActivityThread.java:3438) >> at >> android.app.ActivityThread.performPauseActivity(ActivityThread.java:3395) >> at >> android.app.ActivityThread.handlePauseActivity(ActivityThread.java:3378) >> at android.app.ActivityThread.access$2700(ActivityThread.java:129) >> at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2124) >> at android.os.Handler.dispatchMessage(Handler.java:99) >> at android.os.Looper.loop(Looper.java:143) >> at android.app.ActivityThread.main(ActivityThread.java:4717) >> at java.lang.reflect.Method.invokeNative(Native Method) >> at java.lang.reflect.Method.invoke(Method.java:521) >> at >> com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:860) >> at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:618) >> at dalvik.system.NativeStart.main(Native Method) >> Caused by: java.lang.IllegalStateException: Fragment <MyFragment> is not >> currently in the FragmentManager >> at >> android.support.v4.app.FragmentManagerImpl.putFragment(FragmentManager.java:516) >> at >> android.support.v4.app.FragmentStatePagerAdapter.saveState(FragmentStatePagerAdapter.java:185) >> at >> android.support.v4.view.ViewPager.onSaveInstanceState(ViewPager.java:881) >> at android.view.View.dispatchSaveInstanceState(View.java:6098) >> at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:1323) >> at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:1327) >> at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:1327) >> at android.view.ViewGroup.dispatchSaveInstanceState(ViewGroup.java:1327) >> at android.view.View.saveHierarchyState(View.java:6081) >> at >> com.android.internal.policy.impl.PhoneWindow.saveHierarchyState(PhoneWindow.java:1573) >> at android.app.Activity.onSaveInstanceState(Activity.java:1094) >> at >> android.support.v4.app.FragmentActivity.onSaveInstanceState(FragmentActivity.java:480) >> at <my activity with the >> ViewPager>.onSaveInstanceState(ContentActivity.java:288) >> at android.app.Activity.performSaveInstanceState(Activity.java:1044) >> at >> android.app.Instrumentation.callActivityOnSaveInstanceState(Instrumentation.java:1180) >> at >> android.app.ActivityThread.performPauseActivity(ActivityThread.java:3420) >> >> Thanks in advanced. >> > -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/android-developers?hl=en

