@Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    ImageView imageView = (ImageView) view.findViewById(R.id.animation_container);

    // Create a new animated drawable. The backend will be set by the backend configurator.
    mAnimatedDrawable = new AnimatedDrawable2();

    imageView.setImageDrawable(mAnimatedDrawable);

    mAnimationControlsManager =
        new AnimationControlsManager(
            mAnimatedDrawable,
            (SeekBar) view.findViewById(R.id.seekbar),
            (ToggleButton) view.findViewById(R.id.playpause),
            view.findViewById(R.id.reset));

    new SampleAnimationBackendConfigurator((Spinner) view.findViewById(R.id.spinner), this);
  }
Sample that displays an animated image and media controls to start / stop / seek.
samples/animation2/src/main/java/com/facebook/samples/animation2/MediaControlFragment.java