运行应用程序时出错

时间:2013-03-11 11:04:10

标签: android stack-overflow tabactivity

在我的Android应用程序中,主Activity是tabActivity,其中一个标签包含另一个Tab活动。我用不同的视图加载第二个活动。

在模拟器上加载应用程序时出错。

03-11 16:28:46.463: E/AndroidRuntime(23736): FATAL EXCEPTION: main
03-11 16:28:46.463: E/AndroidRuntime(23736): java.lang.StackOverflowError
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.text.Styled.measureText(Styled.java:430)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.text.Layout.measureText(Layout.java:1655)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.text.Layout.getLineMax(Layout.java:689)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.text.Layout.draw(Layout.java:340)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.text.BoringLayout.draw(BoringLayout.java:365)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.widget.TextView.onDraw(TextView.java:4150)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.View.draw(View.java:6880)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.widget.AbsListView.dispatchDraw(AbsListView.java:1480)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.widget.ListView.dispatchDraw(ListView.java:3138)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.widget.ExpandableListView.dispatchDraw(ExpandableListView.java:229)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.View.draw(View.java:6986)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.widget.AbsListView.draw(AbsListView.java:2584)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.View.draw(View.java:6883)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1862)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewRoot.draw(ViewRoot.java:1522)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewRoot.performTraversals(ViewRoot.java:1258)
03-11 16:28:46.463: E/AndroidRuntime(23736):    at android.view.ViewRoot.handleMessage(ViewR

2 个答案:

答案 0 :(得分:0)

当正在运行的程序的堆栈深度超过某个平台或VM特定限制时抛出。通常,这只会在程序变为无限递归时发生,但也可能在正确编写(但深度递归)的程序中发生。 More Details

答案 1 :(得分:0)

最有可能在您的子活动中,您尝试再次加载第一个活动,加载第二个活动,再次加载第一个活动等等,导致递归并且您的应用程序因为达到内存限制而死亡,应用通过操作系统。