java - Android - Shared element transitions with calling activity finish() -


i'm working on making application more material , i'm stuck on how implement shared element transitions. have activity starts b , calls finish() in order remove stack. in case have element want share between 2 activities, once passed b, no longer matters. if don't call finish() after startactivity(ctx,intent, bundle) exit/enter animation works perfectly. however, if call finish, there's ugly flicker before animation starts.

is there i'm overlooking or not possible trying do?

you can finish activity in onstop function, if want happen when transition b create flag , set after call startactivity(ctx,intent, bundle):

@override public void onstop() {     super.onstop();     if(mshouldfinish)          finish(); } 

make sure when done activity b call finish() , not finishaftertranstion() since activity no longer there

after finishing activity a, shared element in b might hang in screen if press back. set transitionname null in activityb.onenteranimationcomplete avoid this.


Popular posts from this blog