在片段之间快速移动时堆栈溢出异常

时间:2015-07-22 12:31:08

标签: android android-fragments fragmentmanager

当我在片段之间快速切换时,我得到以下堆栈跟踪(片段事务而不添加到backstack)。 (每秒5个片段)。知道为什么会这样吗?

java.lang.StackOverflowError
        at android.support.v4.app.FragmentActivity.onPrepareOptionsPanel(FragmentActivity.java:472)
        at android.support.v4.app.FragmentActivity.onPreparePanel(FragmentActivity.java:461)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.app.AppCompatDelegateImplBase$AppCompatWindowCallbackBase.onPreparePanel(AppCompatDelegateImplBase.java:294)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(ToolbarActionBar.java:541)
        at android.support.v7.internal.view.WindowCallbackWrapper.onPreparePanel(WindowCallbackWrapper.java:89)
        at android.support.v7.internal.app.ToolbarActionBar$ToolbarCallbackWrapper.onPreparePanel(Too

1 个答案:

答案 0 :(得分:0)

当您的应用程序进入无限循环时发生StackOverflowError。在您的输出中,我们可以看到onPreparePanel在捕获错误之前被多次调用。

尝试检查onPreparePanel可能出现的问题以及触发它的内容,以便开始循环播放。