Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android: get system default activity transition animations

Is there any way to get system default (vendor-specific) activity transitions? I need them to replace "open" transition to "close" so when I start a certain activity it would look like user is going back while the activity is actually starting.

I've already tried to do it using reflection but I didn't find these animations in classes com.android.internal.R$anim and android.R$anim even when they are referred from styles.xml in the SDK. Copying animation XML files from the SDK to my project is not an option because they are vendor-specific.

like image 398
Grishka Avatar asked Jul 08 '13 17:07

Grishka


1 Answers

You can override default animation with your own animation. So you can replace "open" transition to "close"

@Override
public void onBackPressed() {
    super.onBackPressed();
    overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);
}
like image 162
Anisuzzaman Babla Avatar answered Sep 28 '22 07:09

Anisuzzaman Babla