Reputation: 4253
I use addSharedElement()
with fragments, and I want to know if there are possibilities to add a listener to execute some methods after the end of this transition.
Thanks for the help.
Upvotes: 1
Views: 1076
Reputation: 62189
Fragment#setEnterSharedElementCallback(SharedElementCallback)
does precisely that.
public class MyFragment extends Fragment {
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setEnterSharedElementCallback(new SharedElementCallback() {
@Override
public void onSharedElementEnd(List<String> sharedElementNames, List<View> sharedElements, List<View> sharedElementSnapshots) {
// transition has ended
}
});
}
}
Upvotes: 3