1

I'm trying to perform fade out animation on activity but I only want to fade out and not fade in.
I saw this question: How to perform a fade animation on Activity transition? but it uses

overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);

which also has fade in option that I don't want, I know I can make my own animation file and just leave it empty but it seems to my like not elegant solution. Is there anyway to ignore the fade in option in this function?

ATP
  • 2,939
  • 4
  • 13
  • 34

1 Answers1

2

Yes, it's simple, the "id" for no animation is 0. So you can do the following:

overridePendingTransition(0, android.R.anim.fade_out);
Sergio Pardo
  • 774
  • 6
  • 17
  • Thanks for the answer! I don't know why I missed this https://developer.android.com/reference/android/app/Activity#overridePendingTransition(int,%20int) – ATP Oct 09 '21 at 17:48