views:

1386

answers:

3

Hi,

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?

Hope to get a quick response.

Regards

Sunil

+3  A: 

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.

Praveen Chandrasekaran
Thanks for the reply. The method overridePendingTransition is supported from API level 5 and I want the application to be supported from Android 1.5. Is there any other way of providing Animation from one Activity to other.
sunil
A: 

Hi All,

Can someone please let me know the way of providing animation when calling another Activity.

It must be possible, so can someone please let me know over here how is that possible?

Regards

Sunil

sunil
+1  A: 

You can prevent the default animation (Slide in from the right) with the Intent.FLAG_ACTIVITY_NO_ANIMATION flag in your intent.

i.e.:

Intent myIntent = new Intent(context, MyActivity.class);
myIntent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
context.startActivity(myIntent);

then in your Activity you simply have to specify your own animation.

Mannaz