我得到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中有一个活动,现在我正在这个活动组中添加新的活动单击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不支持太多嵌套的CCD_ 6可能存在一些内存问题。
有时,这些选项卡在Emulator上运行良好,但在实际设备上部署时会显示出挑衅的StackOverflowException
。
因此,最简单的方法是更改Activity
流(例如,从父ActivityGroup
中取出子ActivityGroup
并在整个屏幕中显示(
欲了解更多信息,请参阅此处,由Romain Guy 回答