Customizable Activity Animation in Java Code

I want to use my own animation when switching activity, I know it can be done in xml. But it is important that the code executes it because the position in which it should be animated is relative.

overridePendingTransition(slideLeft, slideRight);

      

slideLeft and slideRight are animation defined in code. is there any way to assign a resId to animation defined in code? Thanks to

+3


source to share


1 answer


AFAIK, there is no API for this. However, I can offer you a solution:

1) You may need to move all content to a different layout.



2) Then set the animation created in code in onCreate () to content view.

0


source







All Articles