I'm creating my own Android Launcher.
The problem is:
I've alread been able to remove the launch animation with:
Intent launch_intent = new Intent("android.intent.action.MAIN");
launch_intent.addCategory("android.intent.category.LAUNCHER");
launch_intent.setComponent(new ComponentName(packageName, name));
launch_intent.addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION);
activity.startActivity(launch_intent);
My objective is to:
Thanks in advance!
I had a look at the Android API demos, As was suggested you should use the "overridePendingTransition()" method, it sets the animation of the incoming activity and the animation of the outgoing activity.
The method shoud be added afer startActivity() or after finish():
Intent launch_intent = new Intent("android.intent.action.MAIN");
launch_intent.addCategory("android.intent.category.LAUNCHER");
launch_intent.setComponent(new ComponentName(packageName, name));
activity.startActivity(launch_intent);
overridePendingTransition(R.anim.zoom_enter, R.anim.zoom_exit);
The transitions are standard android animations, for example the zoom_enter will be something like that:
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator">
<scale android:fromXScale="2.0" android:toXScale="1.0"
android:fromYScale="2.0" android:toYScale="1.0"
android:pivotX="50%p" android:pivotY="50%p"
android:duration="@android:integer/config_mediumAnimTime" />
</set>
If you also want to set an animation when your activity is being closed, for example when user presses the back or home button, you should add the overridePendingTransition() to the onPause() method.
If you want to set an animation when your activity is being launched by some other application, add the overridePendingTransition() before the super.onCreate().