Question

I've programmed an android App, everything works fine, exept for one thing: when i switch from one activity to another, it makes this "activity opens" animation, you know, when it opens like a new app. Is there any way to open an activity without that Animation? Thanks

Was it helpful?

Solution

You can try to use a Flag with your Intent as follows:

Intent intent = new Intent(Activity1.this, Activity2.class);
intent.setFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
startActivity(intent);  

But keep in mind:

If set in an Intent passed to Context.startActivity(), this flag will prevent the system from applying an activity transition animation to go to the next activity state. This doesn't mean an animation will never run -- if another activity change happens that doesn't specify this flag before the activity started here is displayed, then that transition will be used. This flag can be put to good use when you are going to do a series of activity operations but the animation seen by the user shouldn't be driven by the first activity change but rather a later one.

Or you can define a custom animation in your style with @android:style/Animation.Activity parent as @null parameter for the animations that you do not want.

OTHER TIPS

After starting intent you can use:

overridePendingTransition(0, 0);

To remove any animation. First parameter goes for animating opening activity and second for activity that is moved back. Both refer to anim resource

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top