我得到stackoverflow error
我的布局结构如下

<TabActivity>
    <tab1><Activity name="home">
    <tab2><Activitygroup><activity name="XYZ">
                <activity name="options">
                <activity name="thankYou">
    <tab3>
        <TabActivity>
            <tab3.1><Activitygroup><activities name="PQR">
            <tab3.2><activity name="today">
            <tab3.3><activity name="history">
            <tab3.4><Activitygroup>
                    <activity name="reOrder"> from this I will open
                    <Activity name="options">
        <TabActivity>
    <tab4><Activitygroup><activities name="ABC">
    <tab5><Activity name="setting">
<TabActivity>

我在tab3.4中时出错。
我在activitygroup中有一个活动,现在我正在添加此activitygroup中的新活动
“下一步”按钮单击了tab3.4活动组中的第一个活动。
我调试了它,并检查直到onresume()它工作正常,但之后它会触发错误。
在得到错误之前,我还可以看到新的活动。
另外,如果我打开另一个活动,它是工作良好。当时它工作得很好。
堆栈跟踪
11-23 07:06:24.912: WARN/dalvikvm(1783): threadid=3: thread exiting with uncaught exception (group=0x4001b188)
11-23 07:06:24.912: ERROR/AndroidRuntime(1783): Uncaught handler: thread main exiting due to uncaught exception
11-23 07:06:24.943: ERROR/AndroidRuntime(1783): java.lang.StackOverflowError
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.text.Styled.measureText(Styled.java:371)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.text.Layout.measureText(Layout.java:1601)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.text.Layout.getLineMax(Layout.java:655)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.text.Layout.getLineWidth(Layout.java:637)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.widget.TextView.getRightFadingEdgeStrength(TextView.java:6713)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6608)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6538)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6641)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6538)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6538)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6641)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6538)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6538)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6538)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6538)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1529)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6538)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6538)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.drawChild(ViewGroup.java:1531)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1258)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.View.draw(View.java:6538)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.widget.FrameLayout.draw(FrameLayout.java:352)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1830)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewRoot.draw(ViewRoot.java:1349)
11-23 07:06:24.943: ERROR/AndroidRuntime(1783):     at android.view.ViewRoo

请帮我解决这个问题。
谢谢。

最佳答案

恐怕您需要其他解决方法,而不是在另一个ActivityGroup中嵌套ActivityGroup
因为android不支持太多嵌套ViewGroup可能是内存问题。
有时这些选项卡在Emulator上工作得很好,但在实际设备上部署时却会显示明显的StackOverflowException
因此,最简单的方法是改变Activity流(例如将子ActivityGroup从父ActivityGroup中取出并在整个屏幕中显示)
For further see here, answer by Romain Guy

08-18 18:10