Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animate activity which is not part of your app

How can I apply closing transition on activity which is not part of my app. Say, I am opening contacts app for picking contacts, I apply slide up transition when opening contacts app but closing app applies default animation (slide left).

Is there any possibility of animating it on closing too?

like image 952
mallaudin Avatar asked Mar 15 '17 12:03

mallaudin


1 Answers

I assume when you start activity of another app (in this example it is Contacts app) you use overridePendingTransition() in your activity for the animation, something like this :

Intent intent= new Intent(Intent.ACTION_PICK,  ContactsContract.Contacts.CONTENT_URI);
startActivityForResult(intent, requestCode);
overridePendingTransition(R.anim.slide_in_right_to_left, android.R.anim.fade_out);

In onResume() method of your activity you can use overridePendingTransition() as well to animate activity (that is from Contacts app) from which you return:

@Override
protected void onResume() {
    overridePendingTransition(0, android.R.anim.slide_out_right);
    super.onResume();
}
like image 139
Sergey Avatar answered Sep 23 '22 15:09

Sergey