public final class BackgroundManager
extends Object


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.

When the last Activity is destroyed, the background state is reset.

Backgrounds consist of several layers, from back to front:

BackgroundManager holds references to potentially large bitmap Drawables. Call release() to release these references when the Activity is not visible.


Public methods

void attach(Window window)

Makes the background visible on the given Window.

void attachToView(View sceneRoot)

Adds the composite drawable to the given view.

void clearDrawable()

Clears the Drawable set by setDrawable(Drawable) or setBitmap(Bitmap).

int getColor()

Returns the current background color.

Drawable getDefaultDimLayer()

This method is deprecated. No longer support dim layer.

Drawable getDimLayer()

This method is deprecated. No longer support dim layer.

Drawable getDrawable()

Returns the current background Drawable.

static BackgroundManager getInstance(Activity activity)

Returns the BackgroundManager associated with the given Activity.

boolean isAttached()

Returns true if the background manager is currently attached; false otherwise.

boolean isAutoReleaseOnStop()
void release()

Release references to Drawable/Bitmap.