首页 新闻 会员 周边 捐助

Android 出现在Fragment + Adapter 的错误

0
悬赏园豆:50 [待解决问题]

错误代码如下:

 

06-20 09:56:21.366: E/AndroidRuntime(1650): FATAL EXCEPTION: main
06-20 09:56:21.366: E/AndroidRuntime(1650): java.lang.IllegalStateException: Recursive entry to executePendingTransactions
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1388)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.app.FragmentManagerImpl.executePendingTransactions(FragmentManager.java:431)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.app.FragmentPagerAdapter.finishUpdate(FragmentPagerAdapter.java:139)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.view.ViewPager.populate(ViewPager.java:804)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:433)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:405)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.view.ViewPager.onRestoreInstanceState(ViewPager.java:898)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.view.View.dispatchRestoreInstanceState(View.java:12284)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2620)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.view.ViewGroup.dispatchRestoreInstanceState(ViewGroup.java:2626)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.view.View.restoreHierarchyState(View.java:12262)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.app.Fragment.restoreViewState(Fragment.java:407)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:897)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.app.FragmentManagerImpl.moveToState(FragmentManager.java:1080)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.app.BackStackRecord.run(BackStackRecord.java:622)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1416)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.support.v4.app.FragmentManagerImpl$1.run(FragmentManager.java:420)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.os.Handler.handleCallback(Handler.java:730)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.os.Handler.dispatchMessage(Handler.java:92)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.os.Looper.loop(Looper.java:137)
06-20 09:56:21.366: E/AndroidRuntime(1650): at android.app.ActivityThread.main(ActivityThread.java:5103)
06-20 09:56:21.366: E/AndroidRuntime(1650): at java.lang.reflect.Method.invokeNative(Native Method)
06-20 09:56:21.366: E/AndroidRuntime(1650): at java.lang.reflect.Method.invoke(Method.java:525)
06-20 09:56:21.366: E/AndroidRuntime(1650): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:737)
06-20 09:56:21.366: E/AndroidRuntime(1650): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:553)
06-20 09:56:21.366: E/AndroidRuntime(1650): at dalvik.system.NativeStart.main(Native Method)

 

首先我第一次切换到那个Fragment是正常的,但是第二次在切换过去就报错了。

我要是不给里面的ViewPage设置适配器的话就没问题。

希望有人能给出解决方案

LOLHunter的主页 LOLHunter | 初学一级 | 园豆:147
提问于:2016-06-20 18:01
< >
分享
所有回答(1)
0

你的fragment没问题,是你的适配器绑定数据过程中有问题

如此拉风的女人 | 园豆:30 (初学一级) | 2016-06-21 10:45

绑定数据没问题的,要不然第一次加载fragment不就报错了? 我这个是第二次加载才报错的。(fragment嵌套fragment)

支持(0) 反对(0) LOLHunter | 园豆:147 (初学一级) | 2016-06-21 18:12
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册