When I use a "finish ()" to terminate the activity does Android use any end-of-activity animation by default?

2

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.

    
asked by anonymous 29.10.2015 / 18:44

1 answer

2

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);
    
29.10.2015 / 19:55