overridePendingTransition causes error : java.lang.IllegalStateException: The specified child already has a parent
<p>I have an app in which when user taps on a button it takes him to a new activity through an animation. The pressed back the previous activity is created again using animation (transition in/out). Doing this fast cause an error.</p>

<p>code:</p>

<pre><code>    startActivity(intent);
            overridePendingTransition(R.anim.slide_in,R.anim.slide_out);
    finish();
</code></pre>

<p>Error : </p>

<pre><code>java.lang.IllegalStateException: The specified child already has a parent. You must call removeView() on the child's parent first.
at android.view.ViewGroup.addViewInner(ViewGroup.java:3339)
at android.view.ViewGroup.addView(ViewGroup.java:3210)
at android.widget.ViewAnimator.addView(ViewAnimator.java:184)
at android.view.ViewGroup.addView(ViewGroup.java:3155)
at android.view.ViewGroup.addView(ViewGroup.java:3131)
at com.myapps.tryanim.w.onAnimationEnd(Unknown Source)
at android.view.animation.AnimationSet.getTransformation(AnimationSet.java:400)
at android.view.animation.Animation.getTransformation(Animation.java:940)
at android.view.View.drawAnimation(View.java:13200)
at android.view.View.draw(View.java:13339)
at android.view.ViewGroup.drawChild(ViewGroup.java:2928)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:2797)
at android.view.View.draw(View.java:13710)
at android.view.View.getDisplayList(View.java:12645)
at android.view.View.getDisplayList(View.java:12689)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2910)
at android.view.View.getDisplayList(View.java:12583)
at android.view.View.getDisplayList(View.java:12689)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2910)
at android.view.View.getDisplayList(View.java:12583)
at android.view.View.getDisplayList(View.java:12689)
at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:2910)
at android.view.View.getDisplayList(View.java:12583)
at android.view.View.getDisplayList(View.java:12689)
at android.view.HardwareRenderer$GlRenderer.draw(HardwareRenderer.java:1198)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:2173)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2045)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1854)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:989)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:4351)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:749)
at android.view.Choreographer.doCallbacks(Choreographer.java:562)
at android.view.Choreographer.doFrame(Choreographer.java:532)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:735)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5039)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:793)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:560)
at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>What could be problem here.</p>

<p>slide_in xml-anim</p>

<pre><code>&lt;translate
    android:fromXDelta="100%"
    android:toXDelta="0%"
    android:duration="800" /&gt;
</code></pre>

<p>slide_out xml</p>



<pre><code>&lt;translate
    android:fromXDelta="0%"
    android:toXDelta="-100%"
    android:duration="800" /&gt;
</code></pre>
