IT. Expert System.

Android Reference

WallpaperManager


android.app

Class WallpaperManager



  • public class WallpaperManager
    extends Object
    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().
    • Method Detail

      • getInstance

        public static WallpaperManager getInstance(Context context)
        Retrieve a WallpaperManager associated with the given Context.
      • getIWallpaperManager

        public IWallpaperManager getIWallpaperManager()
      • getDrawable

        public Drawable getDrawable()
        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.
        Returns:
        Returns a Drawable object that will draw the wallpaper.
      • peekDrawable

        public Drawable peekDrawable()
        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.
        Returns:
        Returns a Drawable object that will draw the wallpaper or a null pointer if these is none.
      • getFastDrawable

        public Drawable getFastDrawable()
        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).
        Returns:
        Returns a Drawable object that will draw the wallpaper.
      • peekFastDrawable

        public Drawable peekFastDrawable()
        Like getFastDrawable(), but if there is no wallpaper set, a null pointer is returned.
        Returns:
        Returns an optimized Drawable object that will draw the wallpaper or a null pointer if these is none.
      • forgetLoadedWallpaper

        public void forgetLoadedWallpaper()
        Remove all internal references to the last loaded wallpaper. Useful for apps that want to reduce memory usage when they only temporarily need to have the wallpaper. After calling, the next request for the wallpaper will require reloading it again from disk.
      • getWallpaperInfo

        public WallpaperInfo getWallpaperInfo()
        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.
      • setResource

        public void setResource(int resid)
                         throws IOException
        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 Intent.ACTION_WALLPAPER_CHANGED is broadcast.

        This method requires the caller to hold the permission android.Manifest.permission#SET_WALLPAPER.

        Parameters:
        resid - The bitmap to save.
        Throws:
        IOException - If an error occurs reverting to the default wallpaper.
      • setBitmap

        public void setBitmap(Bitmap bitmap)
                       throws IOException
        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 Intent.ACTION_WALLPAPER_CHANGED is broadcast.

        This method requires the caller to hold the permission android.Manifest.permission#SET_WALLPAPER.

        Parameters:
        bitmap - The bitmap to save.
        Throws:
        IOException - If an error occurs reverting to the default wallpaper.
      • setStream

        public void setStream(InputStream data)
                       throws IOException
        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 Intent.ACTION_WALLPAPER_CHANGED is broadcast.

        This method requires the caller to hold the permission android.Manifest.permission#SET_WALLPAPER.

        Parameters:
        data - A stream containing the raw data to install as a wallpaper.
        Throws:
        IOException - If an error occurs reverting to the default wallpaper.
      • hasResourceWallpaper

        public boolean hasResourceWallpaper(int resid)
        Return whether any users are currently set to use the wallpaper with the given resource ID. That is, their wallpaper has been set through setResource(int) with the same resource id.
      • getDesiredMinimumWidth

        public int getDesiredMinimumWidth()
        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.
        Returns:
        The desired minimum width for the wallpaper. This value should be honored by applications that set the wallpaper but it is not mandatory.
      • getDesiredMinimumHeight

        public int getDesiredMinimumHeight()
        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 height for the wallpaper. This value should be honored by applications that set the wallpaper but it is not mandatory.
      • suggestDesiredDimensions

        public void suggestDesiredDimensions(int minimumWidth,
                                    int minimumHeight)
        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.

        Note developers, who don't seem to be reading this. This is for home screens to tell what size wallpaper they would like. Nobody else should be calling this! Certainly not other non-home-screen apps that change the wallpaper. Those apps are supposed to retrieve the suggested size so they can construct a wallpaper that matches it.

        This method requires the caller to hold the permission android.Manifest.permission#SET_WALLPAPER_HINTS.

        Parameters:
        minimumWidth - Desired minimum width
        minimumHeight - Desired minimum height
      • setWallpaperOffsets

        public void setWallpaperOffsets(IBinder windowToken,
                               float xOffset,
                               float yOffset)
        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.
        Parameters:
        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.
      • setWallpaperOffsetSteps

        public void setWallpaperOffsetSteps(float xStep,
                                   float yStep)
        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
        Parameters:
        xStep - The X offset delta from one screen to the next one
        yStep - The Y offset delta from one screen to the next one
      • sendWallpaperCommand

        public void sendWallpaperCommand(IBinder windowToken,
                                String action,
                                int x,
                                int y,
                                int z,
                                Bundle extras)
        Send an arbitrary command to the current active wallpaper.
        Parameters:
        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.
      • clearWallpaperOffsets

        public void clearWallpaperOffsets(IBinder windowToken)
        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.
        Parameters:
        windowToken - The window who these offsets should be associated with, as returned by View.getWindowToken().
      • clear

        public void clear()
                   throws IOException
        Remove any currently set wallpaper, reverting to the system's default wallpaper. On success, the intent Intent.ACTION_WALLPAPER_CHANGED is broadcast.

        This method requires the caller to hold the permission android.Manifest.permission#SET_WALLPAPER.

        Throws:
        IOException - If an error occurs reverting to the default wallpaper.


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 2506 / . Delta: 0.04246 с