private void updateBitmapFrameCache(BitmapFrameCache bitmapFrameCache) {
    mActiveFrameNumber = -1;
    mBitmapAnimationBackend =
        ExampleBitmapAnimationFactory.createColorBitmapAnimationBackend(
            SampleData.COLORS, 300, bitmapFrameCache);

    AnimationBackend backendWithInactivityCheck =
        AnimationBackendUtils.wrapAnimationBackendWithInactivityCheck(
            getContext(), mBitmapAnimationBackend);
    setupFrameInformationContainer(mBitmapAnimationBackend);
    mAnimationControlsManager.updateBackendData(backendWithInactivityCheck);

    mAnimatedDrawable.setAnimationBackend(backendWithInactivityCheck);
    mAnimatedDrawable.invalidateSelf();
  }
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