我有一个带有 5 个标签的标签主机,它们是FragmentActivity
. 其中一个包含一系列 7 个视图。我认为每个都是一个片段,但是当我到达片段 7 时,应用程序爆炸了。
当我在每个片段中按下继续按钮时,我以这种方式开始一个新片段:
MyFragment newFragment = new MyFragment ();
FragmentTransaction transaction = getFragmentManager().beginTransaction();
transaction.replace(R.id.publish_map_direction, newFragment);
transaction.addToBackStack(null);
transaction.commit();
这是错误:
11-14 13:50:33.640: I/dalvikvm(13823): threadid=1: stack overflow on call to Landroid/text/Layout;.draw:VLLLI
11-14 13:50:33.640: I/dalvikvm(13823): method requires 288+20+60=368 bytes, fp is 0x4428a42c (300 left)
11-14 13:50:33.640: I/dalvikvm(13823): expanding stack end (0x4428a300 to 0x4428a000)
11-14 13:50:33.640: I/dalvikvm(13823): Shrank stack (to 0x4428a300, curFrame is 0x4428cc74)
11-14 13:50:33.640: D/AndroidRuntime(13823): Shutting down VM
11-14 13:50:33.640: W/dalvikvm(13823): threadid=1: thread exiting with uncaught exception (group=0x40015578)
11-14 13:50:33.703: E/AndroidRuntime(13823): FATAL EXCEPTION: main
11-14 13:50:33.703: E/AndroidRuntime(13823): java.lang.StackOverflowError
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.widget.TextView.onDraw(TextView.java:4229)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6933)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6936)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6936)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.buildDrawingCache(View.java:6695)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.onAnimationStart(ViewGroup.java:1259)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1505)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6936)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6936)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6936)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6936)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6936)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6936)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.widget.FrameLayout.draw(FrameLayout.java:357)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6936)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6936)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.widget.FrameLayout.draw(FrameLayout.java:357)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6936)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.widget.FrameLayout.draw(FrameLayout.java:357)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.View.draw(View.java:6936)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.widget.FrameLayout.draw(FrameLayout.java:357)
11-14 13:50:33.703: E/AndroidRuntime(13823): at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1904)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewRoot.draw(ViewRoot.java:1527)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewRoot.performTraversals(ViewRoot.java:1263)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.view.ViewRoot.handleMessage(ViewRoot.java:1865)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.os.Handler.dispatchMessage(Handler.java:99)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.os.Looper.loop(Looper.java:130)
11-14 13:50:33.703: E/AndroidRuntime(13823): at android.app.ActivityThread.main(ActivityThread.java:3687)
11-14 13:50:33.703: E/AndroidRuntime(13823): at java.lang.reflect.Method.invokeNative(Native Method)
11-14 13:50:33.703: E/AndroidRuntime(13823): at java.lang.reflect.Method.invoke(Method.java:507)
11-14 13:50:33.703: E/AndroidRuntime(13823): at com.
我应该以不同的方式构建我的应用程序吗?