Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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 searched the web, saw all the threads from Stack Overflow, but not able to fix this.

like image 744
Nik Avatar asked Dec 01 '22 22:12

Nik


1 Answers

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.

like image 102
Nik Avatar answered Dec 10 '22 13:12

Nik