tags:

views:

930

answers:

5

Hi,

I have an activity which launches another activity, via a button click. By default, on newer OS versions of android, the OS will animate the new activity sliding in from right to left.

Is there a way to disable this animation? I just want the new activity to appear without any sort of animation.

Thanks

A: 

I stand corrected on this , but it is a system setting in the OS , you might be able to disable it my changing this settings but its not highly recommended as a choice like this should be left up to the user.

RC1140
no, there's an option to disable animation on per-activity basis. No need to change settings
Alexander Kosenkov
A: 

Just specify Intent.FLAG_ACTIVITY_NO_ANIMATION flag when starting

Alexander Kosenkov
A: 

2Alexander Kosenkov: It works only in direct navigation, when we call startActivity(...) with given Intent. But, it does not work when I return back

Andrey
+2  A: 

The FLAG_ACTIVITY_NO_ANIMATION flag works fine for disabling the animation when starting activities.

However, I can't seem to find a way to disable the similar animation that is triggered when i call finish() on an Activity, i.e the animation slides from right to left instead.

I tried setting the flag on the Intent passed to Activity.setResult(...) but it does not seem to make any difference.

Anyone know how to solve this?

EDIT: Found the solution, you can call overridePendingTransition(0, 0) after calling finish() and the next animation will be excluded. This also works on the in-animation if you call overridePendingTransition(0, 0) after calling startActivity(...)

Mattias
+1  A: 

This is possible in 2.0. If I want to do same in 1.6 or below then is it possible? If yes please let me know. Thanks

sachin