2

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

from one layout to another.

vizzz
  • 37
  • 1
  • 1
  • 8
  • possible duplicate of [Transition effects and Intents](http://stackoverflow.com/questions/10507057/transition-effects-and-intents) – Matthieu Jan 04 '13 at 15:03

2 Answers2

6

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);
Sahil Mahajan Mj
  • 11,033
  • 8
  • 53
  • 100
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

Community
  • 1
  • 1
Manoj Fegde
  • 4,786
  • 15
  • 50
  • 95