Nik Nik - 3 months ago 72
Android Question

overridePendingTransition not working in android

The following code is not working for me.

finish();
overridePendingTransition(R.anim.slide_up,R.anim.slide_up);
startActivity(intent);
overridePendingTransition(R.anim.slide_up,R.anim.slide_up);


and the xml for animation is

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="50%p" android:toXDelta="-50"
android:duration="@android:integer/config_mediumAnimTime"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_mediumAnimTime" />
</set>


I googled all the threads, saw all the treads from stack over flow. but not able to fix this...

Raj

Nik Nik
Answer

I made it work out in the following way

I have removed the

overridePendingTransition(R.anim.slide_up,R.anim.slide_up);

from the above code and placed it in onPause(). and it worked like a charm...

I hope it helps others.

Raj