问题
I am getting stackoverflow error
My layout structure as below
<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>
I am getting error when I am in tab3.4
.
I have one activity in Activitygroup and now I am adding new activity in this activitygroup when
next button clicked on first activity in activitygroup of tab3.4
.
I debugged it and check that till the onResume() it is working fine but after that it is firing error. Before getting error also I can see the new activity.
Also if I open another activity it is working fine. At that time It is working perfactly.
Stacktrace
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
Please help me out from this issue.
Thanks.
回答1:
I am afraid you will need any other workaround instead of nesting ActivityGroup
in another ActivityGroup
because android doesn't support too many nested ViewGroup
may be some memory issues.
and some times these tabs work perfectly on Emulator but will show defiantly StackOverflowException
while deployed on real devices.
So the simplest is to change Activity
flow (e.g getting child ActivityGroup
out of parent ActivityGroup
and show it in entire screen)
For further see here, answer by Romain Guy
来源:https://stackoverflow.com/questions/8238134/java-lang-stackoverflowerror-while-adding-new-activity-in-activity-group