Can I change the Android startActivity() transition animation?

coneybeare picture coneybeare · Aug 18, 2010 · Viewed 141.2k times · Source

I am starting an activity and would rather have a alpha fade-in for startActivity(), and a fade-out for the finish(). How can I go about this in the Android SDK?

Answer

Allen Chan picture Allen Chan · Feb 15, 2012

Starting from API level 5 you can call overridePendingTransition immediately to specify an explicit transition animation:

startActivity();
overridePendingTransition(R.anim.hold, R.anim.fade_in);

or

finish();
overridePendingTransition(R.anim.hold, R.anim.fade_out);