BackgroundManager

This package is part of the
Android support library which
is no longer maintained.
The support library has been superseded by AndroidX
which is part of Jetpack.
We recommend using the AndroidX libraries in all new projects. You should also consider
migrating existing projects to AndroidX.

public
final
class
BackgroundManager
extends Object

java.lang.Object

↳

android.support.v17.leanback.app.BackgroundManager

Supports background image continuity between multiple Activities.

An Activity should instantiate a BackgroundManager and attach(Window)
to the Activity's window. When the Activity is started, the background is
initialized to the current background values stored in a continuity service.
The background continuity service is updated as the background is updated.

At some point, for example when it is stopped, the Activity may release
its background state.

When an Activity is resumed, if the BackgroundManager has not been
released, the continuity service is updated from the BackgroundManager state.
If the BackgroundManager was released, the BackgroundManager inherits the
current state from the continuity service.

isAutoReleaseOnStop

release

Release references to Drawable/Bitmap. Typically called in Activity onStop() to reduce memory
overhead when not visible. It's app's responsibility to restore the drawable/bitmap in
Activity onStart(). The method is automatically called in onStop() when
isAutoReleaseOnStop() is true.

setBitmap

Sets the given bitmap into the background. When using setCoverImageBitmap to set the
background, the provided bitmap will be scaled and cropped to correctly
fit within the dimensions of the view. The timing for when this becomes
visible in the app is undefined and may take place after a small delay.

setDrawable

Sets the given drawable into the background. The provided Drawable will be
used unmodified as the background, without any scaling or cropping
applied to it. The timing for when this becomes visible in the app is
undefined and may take place after a small delay.