java.lang.Object | |
↳ | android.app.WallpaperManager |
Provides access to the system wallpaper. With WallpaperManager, you can
get the current wallpaper, get the desired dimensions for the wallpaper, set
the wallpaper, and more. Get an instance of WallpaperManager with
getInstance()
.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
String | ACTION_LIVE_WALLPAPER_CHOOSER | Launch an activity for the user to pick the current global live wallpaper. | |||||||||
String | COMMAND_DROP | Command for sendWallpaperCommand(IBinder, String, int, int, int, Bundle) : reported by the wallpaper
host when the user drops an object into an area of the host. |
|||||||||
String | COMMAND_TAP | Command for sendWallpaperCommand(IBinder, String, int, int, int, Bundle) : reported by the wallpaper
host when the user taps on an empty area (not performing an action
in the host). |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Remove any currently set wallpaper, reverting to the system's default
wallpaper.
| |||||||||||
Clear the offsets previously associated with this window through
setWallpaperOffsets(IBinder, float, float) . | |||||||||||
Returns the desired minimum height for the wallpaper.
| |||||||||||
Returns the desired minimum width for the wallpaper.
| |||||||||||
Retrieve the current system wallpaper; if
no wallpaper is set, the system default wallpaper is returned.
| |||||||||||
Like
getDrawable() , but the returned Drawable has a number
of limitations to reduce its overhead as much as possible. | |||||||||||
Retrieve a WallpaperManager associated with the given Context.
| |||||||||||
If the current wallpaper is a live wallpaper component, return the
information about that wallpaper.
| |||||||||||
Retrieve the current system wallpaper; if there is no wallpaper set,
a null pointer is returned.
| |||||||||||
Like
getFastDrawable() , but if there is no wallpaper set,
a null pointer is returned. | |||||||||||
Send an arbitrary command to the current active wallpaper.
| |||||||||||
Change the current system wallpaper to a bitmap.
| |||||||||||
Change the current system wallpaper to the bitmap in the given resource.
| |||||||||||
Change the current system wallpaper to a specific byte stream.
| |||||||||||
For applications that use multiple virtual screens showing a wallpaper,
specify the step size between virtual screens.
| |||||||||||
Set the position of the current wallpaper within any larger space, when
that wallpaper is visible behind the given window.
| |||||||||||
For use only by the current home application, to specify the size of
wallpaper it would like to use.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class java.lang.Object
|
Launch an activity for the user to pick the current global live wallpaper.
Command for sendWallpaperCommand(IBinder, String, int, int, int, Bundle)
: reported by the wallpaper
host when the user drops an object into an area of the host. The x
and y arguments are the location of the drop.
Command for sendWallpaperCommand(IBinder, String, int, int, int, Bundle)
: reported by the wallpaper
host when the user taps on an empty area (not performing an action
in the host). The x and y arguments are the location of the tap in
screen coordinates.
Remove any currently set wallpaper, reverting to the system's default
wallpaper. On success, the intent ACTION_WALLPAPER_CHANGED
is broadcast.
IOException | If an error occurs reverting to the default wallpaper. |
---|
Clear the offsets previously associated with this window through
setWallpaperOffsets(IBinder, float, float)
. This reverts
the window to its default state, where it does not cause the wallpaper
to scroll from whatever its last offsets were.
windowToken | The window who these offsets should be associated
with, as returned by View.getWindowToken() .
|
---|
Returns the desired minimum height for the wallpaper. Callers of
setBitmap(android.graphics.Bitmap)
or
setStream(java.io.InputStream)
should check this value
beforehand to make sure the supplied wallpaper respects the desired
minimum height.
If the returned value is <= 0, the caller should use the height of
the default display instead.
Returns the desired minimum width for the wallpaper. Callers of
setBitmap(android.graphics.Bitmap)
or
setStream(java.io.InputStream)
should check this value
beforehand to make sure the supplied wallpaper respects the desired
minimum width.
If the returned value is <= 0, the caller should use the width of
the default display instead.
Retrieve the current system wallpaper; if no wallpaper is set, the system default wallpaper is returned. This is returned as an abstract Drawable that you can install in a View to display whatever wallpaper the user has currently set.
Like getDrawable()
, but the returned Drawable has a number
of limitations to reduce its overhead as much as possible. It will
never scale the wallpaper (only centering it if the requested bounds
do match the bitmap bounds, which should not be typical), doesn't
allow setting an alpha, color filter, or other attributes, etc. The
bounds of the returned drawable will be initialized to the same bounds
as the wallpaper, so normally you will not need to touch it. The
drawable also assumes that it will be used in a context running in
the same density as the screen (not in density compatibility mode).
Retrieve a WallpaperManager associated with the given Context.
If the current wallpaper is a live wallpaper component, return the information about that wallpaper. Otherwise, if it is a static image, simply return null.
Retrieve the current system wallpaper; if there is no wallpaper set, a null pointer is returned. This is returned as an abstract Drawable that you can install in a View to display whatever wallpaper the user has currently set.
Like getFastDrawable()
, but if there is no wallpaper set,
a null pointer is returned.
Send an arbitrary command to the current active wallpaper.
windowToken | The window who these offsets should be associated
with, as returned by View.getWindowToken() . |
---|---|
action | Name of the command to perform. This must be a scoped name to avoid collisions, such as "com.mycompany.wallpaper.DOIT". |
x | Arbitrary integer argument based on command. |
y | Arbitrary integer argument based on command. |
z | Arbitrary integer argument based on command. |
extras | Optional additional information for the command, or null. |
Change the current system wallpaper to a bitmap. The given bitmap is
converted to a PNG and stored as the wallpaper. On success, the intent
ACTION_WALLPAPER_CHANGED
is broadcast.
bitmap | The bitmap to save. |
---|
IOException | If an error occurs reverting to the default wallpaper. |
---|
Change the current system wallpaper to the bitmap in the given resource.
The resource is opened as a raw data stream and copied into the
wallpaper; it must be a valid PNG or JPEG image. On success, the intent
ACTION_WALLPAPER_CHANGED
is broadcast.
resid | The bitmap to save. |
---|
IOException | If an error occurs reverting to the default wallpaper. |
---|
Change the current system wallpaper to a specific byte stream. The
give InputStream is copied into persistent storage and will now be
used as the wallpaper. Currently it must be either a JPEG or PNG
image. On success, the intent ACTION_WALLPAPER_CHANGED
is broadcast.
data | A stream containing the raw data to install as a wallpaper. |
---|
IOException | If an error occurs reverting to the default wallpaper. |
---|
For applications that use multiple virtual screens showing a wallpaper, specify the step size between virtual screens. For example, if the launcher has 3 virtual screens, it would specify an xStep of 0.5, since the X offset for those screens are 0.0, 0.5 and 1.0
xStep | The X offset delta from one screen to the next one |
---|---|
yStep | The Y offset delta from one screen to the next one |
Set the position of the current wallpaper within any larger space, when that wallpaper is visible behind the given window. The X and Y offsets are floating point numbers ranging from 0 to 1, representing where the wallpaper should be positioned within the screen space. These only make sense when the wallpaper is larger than the screen.
windowToken | The window who these offsets should be associated
with, as returned by View.getWindowToken() . |
---|---|
xOffset | The offset along the X dimension, from 0 to 1. |
yOffset | The offset along the Y dimension, from 0 to 1. |
For use only by the current home application, to specify the size of wallpaper it would like to use. This allows such applications to have a virtual wallpaper that is larger than the physical screen, matching the size of their workspace.
minimumWidth | Desired minimum width |
---|---|
minimumHeight | Desired minimum height |