Android StackOverflow问题

时间:2012-02-22 10:26:41

标签: android android-activity stack-overflow

我在Android应用程序中使用ActivityGroup来管理不同活动中的选项卡,并通过

管理活动中的内部导航
    Intent activity3Intent = new Intent(v.getContext(), BookNowSetDateTime.class);
        activity3Intent.putExtra("contextvalue", context_value);
        replaceContentView("activity3", activity3Intent);


    protected void replaceContentView(String id, Intent newIntent) {
        // TODO Auto-generated method stub
        View view = getLocalActivityManager().startActivity(id,newIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) .getDecorView(); this.setContentView(view);

    }

现在因为Intent我的应用程序内部导航得到错误:

  02-22 15:27:52.920: E/ACRA(4344): MaidPro fatal error : null
        02-22 15:27:52.920: E/ACRA(4344): java.lang.StackOverflowError
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.View.draw(View.java:6936)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.View.draw(View.java:6936)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
        02-22 15:27:52.920: E/ACRA(4344):   at android.widget.AbsListView.dispatchDraw(AbsListView.java:1604)
        02-22 15:27:52.920: E/ACRA(4344):   at android.widget.ListView.dispatchDraw(ListView.java:3210)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.View.draw(View.java:6936)
        02-22 15:27:52.920: E/ACRA(4344):   at android.widget.AbsListView.draw(AbsListView.java:3028)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.View.draw(View.java:6936)
        02-22 15:27:52.920: E/ACRA(4344):   at android.widget.FrameLayout.draw(FrameLayout.java:357)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.View.draw(View.java:6936)
        02-22 15:27:52.920: E/ACRA(4344):   at android.widget.FrameLayout.draw(FrameLayout.java:357)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.View.draw(View.java:6936)
        02-22 15:27:52.920: E/ACRA(4344):   at android.widget.FrameLayout.draw(FrameLayout.java:357)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
        02-22 15:27:52.920: E/ACRA(4344):   at android.view.View.draw(View.java:6936)
    02-22 15:27:52.920: E/ACRA(4344):   at android.widget.FrameLayout.draw(FrameLayout.java:357)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.View.draw(View.java:6936)
    02-22 15:27:52.920: E/ACRA(4344):   at android.widget.FrameLayout.draw(FrameLayout.java:357)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.View.draw(View.java:6936)
    02-22 15:27:52.920: E/ACRA(4344):   at android.widget.FrameLayout.draw(FrameLayout.java:357)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.View.draw(View.java:6936)
    02-22 15:27:52.920: E/ACRA(4344):   at android.widget.FrameLayout.draw(FrameLayout.java:357)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.View.draw(View.java:6936)
    02-22 15:27:52.920: E/ACRA(4344):   at android.widget.FrameLayout.draw(FrameLayout.java:357)
    02-22 15:27:52.920: E/ACRA(4344):   at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1901)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewRoot.draw(ViewRoot.java:1530)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewRoot.performTraversals(ViewRoot.java:1266)
    02-22 15:27:52.920: E/ACRA(4344):   at android.view.ViewRoot.handleMessage(ViewRoot.java:1868)
    02-22 15:27:52.920: E/ACRA(4344):   at android
  • 所以我无法捕捉到StackOverflow的这个问题,有没有人能给我更好的解决方案来解决这个问题?

  • 如何删除或清除活动堆栈,以解决此活动死锁问题?

2 个答案:

答案 0 :(得分:0)

你可以这样写:

Intent activity3Intent = new Intent(v.getContext(), BookNowSetDateTime.class);
activity3Intent.putExtra("contextvalue", context_value);
startActivity(activity3Intent);

答案 1 :(得分:0)

不推荐使用

ActivityGroup。您必须使用新的Fragment和FragmentManager API。

我建议您使用ActionBarSherlock以新方式实施操作栏标签。它已包含适用于Android< 3.0的官方Android兼容包,它使用起来非常简单。