stackoverflower在第二次恢复活动时

时间:2012-03-21 10:10:12

标签: android android-intent

我正在设计一款应用,它有Main Activity tabhost。我的观点是,当我点击tabhost栏中的tabwidget时,它会调用Activity A,在Activity A我有一个菜单列表,当我点击1按钮菜单时,它会调用另一个活动Activity B(我在此活动上有主页按钮)。我的问题是,当我第一次点击按钮并点击返回Activity A时,它会正常运行,但是第二次点击它然后返回时,它会得到stackoverflowerror。 我将此代码用于句柄go back

View view = getLocalActivityManager() .startActivity( "Add Ring", new Intent(getApplicationContext(), ProfileView.class) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) .getDecorView(); setContentView(view);

我的错误日志

03-21 16:02:40.343: E/AndroidRuntime(2118): FATAL EXCEPTION: main
03-21 16:02:40.343: E/AndroidRuntime(2118): java.lang.StackOverflowError
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.View.draw(View.java:6986)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.widget.ScrollView.draw(ScrollView.java:1409)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.View.draw(View.java:6883)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.View.draw(View.java:6883)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.View.draw(View.java:6883)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.View.draw(View.java:6883)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.View.draw(View.java:6883)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.View.draw(View.java:6883)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.View.draw(View.java:6883)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.View.draw(View.java:6883)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1646)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.drawChild(ViewGroup.java:1644)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewGroup.dispatchDraw(ViewGroup.java:1373)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.View.draw(View.java:6883)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.widget.FrameLayout.draw(FrameLayout.java:357)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at com.android.internal.policy.impl.PhoneWindow$DecorView.draw(PhoneWindow.java:1862)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewRoot.draw(ViewRoot.java:1522)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewRoot.performTraversals(ViewRoot.java:1258)
03-21 16:02:40.343: E/AndroidRuntime(2118):     at android.view.ViewRoot.handleMessage(ViewRoot.java:1859)

任何解决方案都很感激!

0 个答案:

没有答案