0

Here is my .java file code

aboutus.setOnClickListener( new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent intent = new Intent(MainActivity.this, AboutUsActivity.class);
            overridePendingTransition(R.anim.anim_slide_in_bottom, R.anim.anim_slide_out_top);
            startActivity(intent);
            finish();
        }
    });

And here are my animation files :

slide_in_bottom.xml

<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="350"
android:fromYDelta="100%"
android:interpolator="@android:anim/decelerate_interpolator"
android:toYDelta="0%" />

slide_out_top.xml

<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="350"
android:fromYDelta="0%"
android:interpolator="@android:anim/decelerate_interpolator"
android:toYDelta="-100%" />

Where do you think i am wrong?

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Chintan Mehta
  • 129
  • 1
  • 9
  • https://stackoverflow.com/questions/20690764/overridependingtransition-for-sliding-activities-in-and-out-smoothly – Arpan Sarkar Mar 18 '18 at 17:46
  • Yeah exactly, i referred to that before, but that doesn't help because all the things in that answer are already as per my written animations and code... So where is the error? @Arpanßløødyßadßøy – Chintan Mehta Mar 18 '18 at 18:48

1 Answers1

0

I have had issues like this before when working with overridePendingTransition. The problem might be in the order in which you are calling. Try:

startActivity(intent);
overridePendingTransition(R.anim.anim_slide_in_bottom, R.anim.anim_slide_out_top);
finish();

That should work. If that doesn't work, try calling overridePendingTransition after the finish().

Hope it helps.

Shobhit Puri
  • 25,769
  • 11
  • 95
  • 124