@Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {

    // Get the animation container
    final ImageView imageView = (ImageView) view.findViewById(R.id.animation_container);

    mFrameInformationContainer = (LinearLayout) view.findViewById(R.id.frame_information);

    mAnimatedDrawable = new AnimatedDrawable2();
    mAnimatedDrawable.setDrawListener(new AnimatedDrawable2DebugDrawListener());

    view.findViewById(R.id.invalidate_button)
        .setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                imageView.invalidate();
              }
            });

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

    new BitmapAnimationCacheSelectorConfigurator(
        (Spinner) view.findViewById(R.id.spinner),
        mBitmapFrameCacheChangedListener,
        mFrameCacheListener);

    imageView.setImageDrawable(mAnimatedDrawable);
  }
Fragment that creates a new {@link AnimatedDrawable2} and a custom bitmap animation backend. In
addition, it displays useful debug information, like cached frames.
samples/animation2/src/main/java/com/facebook/samples/animation2/bitmap/BitmapAnimationDebugFragment.java