I have two Activities A and B. I want to have the shrink Animation when Activity A calls B and maximize animation when Activity B calls A. I don't need the animation xml files for this.
When we call another Activity in Android it gives its default animation and then it calls shrink animation.
What I want is that the default animation should not occur and the animation that I want should occur.
Can we actually give the animation when calling another Activity?
This question is related to
android
animation
android-activity
Jelly Bean adds support for this with the ActivityOptions.makeCustomAnimation() method. Of course, since it's only on Jelly Bean, it's pretty much worthless for practical purposes.
Wrote a tutorial so that you can animate your activity's in and out,
Enjoy:
You must use OverridePendingTransition method to achieve it, which is in the Activity class. Sample Animations in the apidemos example's res/anim folder. Check it. More than check the demo in ApiDemos/App/Activity/animation.
Example:
@Override
public void onResume(){
// TODO LC: preliminary support for views transitions
this.overridePendingTransition(R.anim.in_from_right, R.anim.out_to_left);
}
Source: Stackoverflow.com