stackoverflowerror when resume an activity at the second time <p>i am designing an app, it has <code>Main Activity</code> with <code>tabhost</code>. my point is that when i click on a <code>tabwidget</code> in tabhost bar, it call to <code>Activity A</code>, in <code>Activity A</code> I have a list of menu, when i click on 1 button menu it call to another activity <code>Activity B</code> (i have home button on this activity). my problem is that when i click on button for the first time and click back to <code>Activity A</code>, it run normally, but on the second time i click on it and go back, it got <code>stackoverflowerror</code>. I use this code for handle <code>go back</code></p> <p><code>View view = getLocalActivityManager() .startActivity( "Add Ring", new Intent(getApplicationContext(), ProfileView.class) .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP)) .getDecorView(); setContentView(view);</code></p> <p>my error log</p> <pre><code>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) </code></pre> <p>any solutions is appreciate!</p>