ViewSwitcher can't remove the child view?
<p>I removed all child view from the ViewSwitcher by</p>

<pre><code>mSwitcher.removeAllViews();
</code></pre>

<p>But when I add a previously removed view back, it throws an java.lang.IllegalStateException and says I haven't remove this view from its parent.</p>

<p>Here is the code:</p>

<pre><code>View curView = mSwitcher.getCurrentView();

mSwitcher.removeAllViews();

Log.d(TAG, "parent &gt;&gt; " + nextView.getParent());
Log.d(TAG, "switcher &gt;&gt; " + mSwitcher);
mSwitcher.addView(curView);
mSwitcher.addView(nextView);

mSwitcher.showNext();
</code></pre>

<p>the Exception has thrown in this line</p>

<pre><code>mSwitcher.addView(nextView);
</code></pre>

<p>Here is the log:</p>

<pre><code>09-03 10:04:14.551 D/MainActivity( 8852): parent &gt;&gt; null
09-03 10:04:14.551 D/MainActivity( 8852): switcher &gt;&gt; android.widget.ViewSwitcher@43ebb580
09-03 10:04:14.551 D/AndroidRuntime( 8852): Shutting down VM
09-03 10:04:14.551 W/dalvikvm( 8852): threadid=1: thread exiting with uncaught exception (group=0x4001d7e8)
09-03 10:04:14.571 E/AndroidRuntime( 8852): FATAL EXCEPTION: main
09-03 10:04:14.571 E/AndroidRuntime( 8852): java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at android.view.ViewGroup.addViewInner(ViewGroup.java:1970)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at android.view.ViewGroup.addView(ViewGroup.java:1865)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at android.widget.ViewAnimator.addView(ViewAnimator.java:160)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at android.widget.ViewSwitcher.addView(ViewSwitcher.java:66)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at android.view.ViewGroup.addView(ViewGroup.java:1822)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at android.view.ViewGroup.addView(ViewGroup.java:1802)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at com.aimi.appstore.tulipa.ui.activity.MainActivity.setSelected(MainActivity.java:104)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at com.aimi.appstore.tulipa.ui.activity.MainActivity$2.onClick(MainActivity.java:54)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at android.view.View.performClick(View.java:2408)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at android.view.View$PerformClick.run(View.java:8818)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at android.os.Handler.handleCallback(Handler.java:587)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at android.os.Handler.dispatchMessage(Handler.java:92)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at android.os.Looper.loop(Looper.java:123)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at android.app.ActivityThread.main(ActivityThread.java:4627)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at java.lang.reflect.Method.invokeNative(Native Method)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at java.lang.reflect.Method.invoke(Method.java:521)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:868)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:626)
09-03 10:04:14.571 E/AndroidRuntime( 8852):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>
