# WindowAreaSessionPresenter

Artifact: [androidx.window:window](https://developer.android.com/jetpack/androidx/releases/window) [View Source](https://cs.android.com/search?q=file:androidx/window/area/WindowAreaSessionPresenter.kt+class:androidx.window.area.WindowAreaSessionPresenter) Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/window#1.2.0)

*** ** * ** ***


```
@ExperimentalWindowApi
public interface WindowAreaSessionPresenter extends AutoCloseable
```

<br />

*** ** * ** ***

A container that allows getting access to and showing content on a window area. The container is provided from `https://developer.android.com/reference/androidx/window/area/WindowAreaPresentationSessionCallback` when a requested session becomes active. The presentation can be automatically dismissed by the system when the user leaves the primary application window, or can be closed by calling `https://developer.android.com/reference/androidx/window/area/WindowAreaSessionPresenter#close()`.

| See also |
|---|---|
| `https://developer.android.com/reference/androidx/window/area/WindowAreaController#presentContentOnWindowArea(androidx.window.area.WindowAreaToken,android.app.Activity,java.util.concurrent.Executor,androidx.window.area.WindowAreaPresentationSessionCallback)` |   |

## Summary

| ### Public methods |
|---|---|
| `abstract void` | `https://developer.android.com/reference/androidx/window/area/WindowAreaSessionPresenter#close()()` Closes the active session, no-op if the session is not currently active. |
| `abstract @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/content/Context.html` | `https://developer.android.com/reference/androidx/window/area/WindowAreaSessionPresenter#getContext()()` Returns the `https://developer.android.com/reference/android/content/Context.html` associated with the window area. |
| `abstract https://developer.android.com/reference/android/view/Window.html` | `https://developer.android.com/reference/androidx/window/area/WindowAreaSessionPresenter#getWindow()()` Returns the `https://developer.android.com/reference/android/view/Window.html` associated with the active presentation window area or null if there is no `https://developer.android.com/reference/android/view/Window.html` currently active. |
| `abstract void` | `https://developer.android.com/reference/androidx/window/area/WindowAreaSessionPresenter#setContentView(android.view.View)(@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/view/View.html view)` Sets a `https://developer.android.com/reference/android/view/View.html` to show on a window area. |

## Public methods

### close

```
abstract void close()
```

Closes the active session, no-op if the session is not currently active.

### getContext

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/window#1.2.0)

```
abstract @NonNull Context getContext()
```

Returns the `https://developer.android.com/reference/android/content/Context.html` associated with the window area.

### getWindow

Added in [1.4.0](https://developer.android.com/jetpack/androidx/releases/window#1.4.0)

```
abstract Window getWindow()
```

Returns the `https://developer.android.com/reference/android/view/Window.html` associated with the active presentation window area or null if there is no `https://developer.android.com/reference/android/view/Window.html` currently active. This could occur if the presenter has already been dismissed, and there is no expectation that the `https://developer.android.com/reference/android/view/Window.html` would become non-null at a later point. This API can be used to directly access parts of the `https://developer.android.com/reference/android/view/Window.html` API that are not available through the `https://developer.android.com/reference/android/content/Context.html` provided.

### setContentView

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/window#1.2.0)

```
abstract void setContentView(@NonNull View view)
```

Sets a `https://developer.android.com/reference/android/view/View.html` to show on a window area. After setting the view the system can turn on the corresponding display and start showing content.