# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Methods | Inherited Methods

# MediaProjection

`public final class MediaProjection`
`extends Object` ``

java.lang.Object
↳ | android.media.projection.MediaProjection

A token granting applications the ability to capture screen contents and/or record system audio. The exact capabilities granted depend on the type of MediaProjection.

A screen capture session can be started through `MediaProjectionManager#createScreenCaptureIntent`. This grants the ability to capture screen contents, but not system audio.

## Summary

### Nested classes
`class` | `MediaProjection.Callback` Callbacks for the projection session.

### Public methods
`VirtualDisplay` | `createVirtualDisplay(String name, int width, int height, int dpi, int flags, Surface surface, VirtualDisplay.Callback callback, Handler handler)` Creates a `VirtualDisplay` to capture the contents of the screen.
`void` | `registerCallback(MediaProjection.Callback callback, Handler handler)` Register a listener to receive notifications about when the `MediaProjection` changes state.
`void` | `stop()` Stops projection.
`void` | `unregisterCallback(MediaProjection.Callback callback)` Unregister a MediaProjection listener.

### Inherited methods
From class `java.lang.Object`
`Object` | `clone()` Creates and returns a copy of this object.
`boolean` | `equals(Object obj)` Indicates whether some other object is "equal to" this one.
`void` | `finalize()` Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.
`final Class<?>` | `getClass()` Returns the runtime class of this `Object`.
`int` | `hashCode()` Returns a hash code value for the object.
`final void` | `notify()` Wakes up a single thread that is waiting on this object's monitor.
`final void` | `notifyAll()` Wakes up all threads that are waiting on this object's monitor.
`String` | `toString()` Returns a string representation of the object.
`final void` | `wait(long timeout, int nanos)` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object, or some other thread interrupts the current thread, or a certain amount of real time has elapsed.
`final void` | `wait(long timeout)` Causes the current thread to wait until either another thread invokes the `notify()` method or the `notifyAll()` method for this object, or a specified amount of time has elapsed.
`final void` | `wait()` Causes the current thread to wait until another thread invokes the `notify()` method or the `notifyAll()` method for this object.

## Public methods

### createVirtualDisplay

    public VirtualDisplay createVirtualDisplay (String name,
                    int width,
                    int height,
                    int dpi,
                    int flags,
                    Surface surface,
                    VirtualDisplay.Callback callback,
                    Handler handler)

Creates a `VirtualDisplay` to capture the contents of the screen.

Parameters
`name` | `String`: The name of the virtual display, must be non-empty. This value cannot be `null`.
`width` | `int`: The width of the virtual display in pixels. Must be greater than 0.
`height` | `int`: The height of the virtual display in pixels. Must be greater than 0.
`dpi` | `int`: The density of the virtual display in dpi. Must be greater than 0.
`flags` | `int`: A combination of virtual display flags. See `DisplayManager` for the full list of flags.
`surface` | `Surface`: The surface to which the content of the virtual display should be rendered, or null if there is none initially. This value may be `null`.
`callback` | `VirtualDisplay.Callback`: Callback to call when the virtual display's state changes, or null if none. This value may be `null`.
`handler` | `Handler`: The `Handler` on which the callback should be invoked, or null if the callback should be invoked on the calling thread's main `Looper`. This value may be `null`.

Returns
`VirtualDisplay` |

See also:

- `VirtualDisplay`

### registerCallback

    public void registerCallback (MediaProjection.Callback callback,
                    Handler handler)

Register a listener to receive notifications about when the `MediaProjection` changes state.

Parameters
`callback` | `MediaProjection.Callback`: The callback to call.
`handler` | `Handler`: The handler on which the callback should be invoked, or null if the callback should be invoked on the calling thread's looper.

See also:

- `unregisterCallback(MediaProjection.Callback)`

### stop

    public void stop ()

Stops projection.

### unregisterCallback

    public void unregisterCallback (MediaProjection.Callback callback)

Unregister a MediaProjection listener.

Parameters
`callback` | `MediaProjection.Callback`: The callback to unregister.

See also:

- `registerCallback(MediaProjection.Callback, Handler)`

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