Because I would like to put a different animation, and your I put an animation before putting finish()
executes the animation and then the finish with the animation of it.
Because I would like to put a different animation, and your I put an animation before putting finish()
executes the animation and then the finish with the animation of it.
If you simply want to close an activity, without opening another, you can do the following:
overridePendingTransition(0, android.R.anim.slide_out_right);
The parameters that this method receives are: (int enterAnim, int exitAnim)
.
Which are respectively the input animation of the activity being opened and the output animation of the current activity.
So, if you wanted to animate the entry of the second activity, and also the output of yours, do the following:
overridePendingTransition(android.R.anim.slide_in_left, android.R.anim.slide_out_right);
You should call this method immediately after calling the finish();
method, like this:
finish();
overridePendingTransition(0, android.R.anim.slide_out_right);