# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Methods | Inherited Methods

# WindowManager

`public interface WindowManager`
`implements ViewManager`

android.view.WindowManager

The interface that apps use to talk to the window manager.

Each window manager instance is bound to a particular `Display`. To obtain a `WindowManager` for a different display, use `Context#createDisplayContext` to obtain a `Context` for that display, then use `Context.getSystemService(Context.WINDOW_SERVICE)` to get the WindowManager.

The simplest way to show a window on another display is to create a `Presentation`. The presentation will automatically obtain a `WindowManager` and `Context` for that display.

## Summary

### Nested classes
`class` | `WindowManager.BadTokenException` Exception that is thrown when trying to add view whose `LayoutParams` `LayoutParams#token` is invalid.
`class` | `WindowManager.InvalidDisplayException` Exception that is thrown when calling `ViewManager.addView(View, ViewGroup.LayoutParams)` to a secondary display that cannot be found.
`class` | `WindowManager.LayoutParams`

### Public methods
`default WindowMetrics` | `getCurrentWindowMetrics()` Returns the `WindowMetrics` according to the current system state.
`abstract Display` | `getDefaultDisplay()` This method is deprecated. Use `Context#getDisplay()` instead.
`default WindowMetrics` | `getMaximumWindowMetrics()` Returns the largest `WindowMetrics` an app may expect in the current system state.
`abstract void` | `removeViewImmediate(View view)` Special variation of `ViewManager.removeView(View)` that immediately invokes the given view hierarchy's `View#onDetachedFromWindow()` methods before returning.

### Inherited methods
From interface `android.view.ViewManager`
`abstract void` | `addView(View view, ViewGroup.LayoutParams params)` Assign the passed LayoutParams to the passed View and add the view to the window.
`abstract void` | `removeView(View view)`
`abstract void` | `updateViewLayout(View view, ViewGroup.LayoutParams params)`

## Public methods

### getCurrentWindowMetrics

    public WindowMetrics getCurrentWindowMetrics ()

Returns the `WindowMetrics` according to the current system state.

The metrics describe the size of the area the window would occupy with `LayoutParams#MATCH_PARENT` width and height, and the `WindowInsets` such a window would have.

The value of this is based on the current windowing state of the system. For example, for activities in multi-window mode, the metrics returned are based on the current bounds that the user has selected for the `Activity`'s task.

Returns
`WindowMetrics` | This value cannot be `null`.

See also:

- `getMaximumWindowMetrics()`
- `WindowMetrics`

### getDefaultDisplay

    public abstract Display getDefaultDisplay ()

This method is deprecated.
Use `Context#getDisplay()` instead.

Returns the `Display` upon which this `WindowManager` instance will create new windows.

Despite the name of this method, the display that is returned is not necessarily the primary display of the system (see `Display#DEFAULT_DISPLAY`). The returned display could instead be a secondary display that this window manager instance is managing. Think of it as the display that this `WindowManager` instance uses by default.

To create windows on a different display, you need to obtain a `WindowManager` for that `Display`. (See the `WindowManager` class documentation for more information.)

Returns
`Display` | The display that this window manager is managing.

### getMaximumWindowMetrics

    public WindowMetrics getMaximumWindowMetrics ()

Returns the largest `WindowMetrics` an app may expect in the current system state.

The metrics describe the size of the largest potential area the window might occupy with `LayoutParams#MATCH_PARENT` width and height, and the `WindowInsets` such a window would have.

The value of this is based on the largest potential windowing state of the system. For example, for activities in multi-window mode, the metrics returned are based on the what the bounds would be if the user expanded the `Activity`'s task to cover the entire screen. Note that this might still be smaller than the size of the physical display if certain areas of the display are not available to windows created in this `Context`.

Returns
`WindowMetrics` | This value cannot be `null`.

See also:

- `getMaximumWindowMetrics()`
- `WindowMetrics`

### removeViewImmediate

    public abstract void removeViewImmediate (View view)

Special variation of `ViewManager.removeView(View)` that immediately invokes the given view hierarchy's `View#onDetachedFromWindow()` methods before returning. This is not for normal applications; using it correctly requires great care.

Parameters
`view` | `View`: The view to be removed.

Full name *
Email address *
Company / developer name
One of your Play Store app URLs *
Which best describes your business:*
Apps
Games
Apps & Games
*
*