'MotionLayout jump to end ConstraintSet programmatically

There is an option to jump to end ConstraintSet in XML in MotionLayout.

<Transition
    app:autoTransition="jumpToEnd"
    motion:constraintSetEnd="@+id/constraintStart"
    motion:constraintSetStart="@+id/constraintEnd"
    motion:duration="300" />

Can this be done programmatically?



Solution 1:[1]

use transitionToEnd() method of MotionLayout

Solution 2:[2]

Use the setProgress to 1f method did take effect ,but I can not receive the onTransitionCompleted event in TransitionListener

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MJ Studio
Solution 2 Kai - Kazuya Ito