How to add transition effect for layouts in android when using intents

11,163

Solution 1

If you want to add transition effects when you shift from one Activity to other, use the following code,

Intent i = new Intent(First.this, Second.class);
i.putExtra("data", data);
startActivity(i);

/** Fading Transition Effect */
First.this.overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);

Solution 2

So for the animation use the code in OnCreate() of second activity as:

overridePendingTransition(R.anim.fadein, R.anim.fadeout);

Or

After intent

    First.this.overridePendingTransition(R.anim.fadein, R.anim.fadeout);

This will help you alot. Following links will help you:Animation

Animation2

Share:
11,163
Admin
Author by

Admin

Updated on June 05, 2022

Comments

  • Admin
    Admin almost 2 years

    How to add transition effect for layouts in android when using intents.

    from one layout to another.