# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Nested Classes | Methods | Inherited Methods

# ClipboardManager

`public class ClipboardManager`
`` `extends ClipboardManager` ``

java.lang.Object
↳ | android.text.ClipboardManager
| ↳ | android.content.ClipboardManager

Interface to the clipboard service, for placing and retrieving text in the global clipboard.

The ClipboardManager API itself is very simple: it consists of methods to atomically get and set the current primary clipboard data. That data is expressed as a `ClipData` object, which defines the protocol for data exchange between applications.

### Developer Guides

For more information about using the clipboard framework, read the Copy and Paste developer guide.

## Summary

### Nested classes
`interface` | `ClipboardManager.OnPrimaryClipChangedListener` Defines a listener callback that is invoked when the primary clip on the clipboard changes.

### Public methods
`void` | `addPrimaryClipChangedListener(ClipboardManager.OnPrimaryClipChangedListener what)`
`void` | `clearPrimaryClip()` Clears any current primary clip on the clipboard.
`ClipData` | `getPrimaryClip()` Returns the current primary clip on the clipboard.
`ClipDescription` | `getPrimaryClipDescription()` Returns a description of the current primary clip on the clipboard but not a copy of its data.
`CharSequence` | `getText()` This method is deprecated. Use `getPrimaryClip()` instead. This retrieves the primary clip and tries to coerce it to a string.
`boolean` | `hasPrimaryClip()` Returns true if there is currently a primary clip on the clipboard.
`boolean` | `hasText()` This method is deprecated. Use `hasPrimaryClip()` instead.
`void` | `removePrimaryClipChangedListener(ClipboardManager.OnPrimaryClipChangedListener what)`
`void` | `setPrimaryClip(ClipData clip)` Sets the current primary clip on the clipboard.
`void` | `setText(CharSequence text)` This method is deprecated. Use `setPrimaryClip(android.content.ClipData)` instead. This creates a ClippedItem holding the given text and sets it as the primary clip. It has no label or icon.

### Inherited methods
From class `android.text.ClipboardManager`
`abstract CharSequence` | `getText()` Returns the text on the clipboard.
`abstract boolean` | `hasText()` Returns true if the clipboard contains text; false otherwise.
`abstract void` | `setText(CharSequence text)` Sets the contents of the clipboard to the specified text.
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

### addPrimaryClipChangedListener

    public void addPrimaryClipChangedListener (ClipboardManager.OnPrimaryClipChangedListener what)

Parameters
`what` | `ClipboardManager.OnPrimaryClipChangedListener`

### clearPrimaryClip

    public void clearPrimaryClip ()

Clears any current primary clip on the clipboard.

See also:

- `setPrimaryClip(ClipData)`

### getPrimaryClip

    public ClipData getPrimaryClip ()

Returns the current primary clip on the clipboard. If the application is not the default IME or does not have input focus this return `null`.

Returns
`ClipData` |

See also:

- `setPrimaryClip(ClipData)`

### getPrimaryClipDescription

    public ClipDescription getPrimaryClipDescription ()

Returns a description of the current primary clip on the clipboard but not a copy of its data. If the application is not the default IME or does not have input focus this return `null`.

Returns
`ClipDescription` |

See also:

- `setPrimaryClip(ClipData)`

### getText

    public CharSequence getText ()

This method is deprecated.
Use `getPrimaryClip()` instead. This retrieves the primary clip and tries to coerce it to a string.

Returns the text on the clipboard. It will eventually be possible to store types other than text too, in which case this will return null if the type cannot be coerced to text.

Returns
`CharSequence` |

### hasPrimaryClip

    public boolean hasPrimaryClip ()

Returns true if there is currently a primary clip on the clipboard. If the application is not the default IME or the does not have input focus this will return `false`.

Returns
`boolean` |

### hasText

    public boolean hasText ()

This method is deprecated.
Use `hasPrimaryClip()` instead.

Returns true if the clipboard contains text; false otherwise.

Returns
`boolean` |

### removePrimaryClipChangedListener

    public void removePrimaryClipChangedListener (ClipboardManager.OnPrimaryClipChangedListener what)

Parameters
`what` | `ClipboardManager.OnPrimaryClipChangedListener`

### setPrimaryClip

    public void setPrimaryClip (ClipData clip)

Sets the current primary clip on the clipboard. This is the clip that is involved in normal cut and paste operations.

Parameters
`clip` | `ClipData`: The clipped data item to set. This value cannot be `null`.

See also:

- `getPrimaryClip()`
- `clearPrimaryClip()`

### setText

    public void setText (CharSequence text)

This method is deprecated.
Use `setPrimaryClip(android.content.ClipData)` instead. This creates a ClippedItem holding the given text and sets it as the primary clip. It has no label or icon.

Sets the contents of the clipboard to the specified text.

Parameters
`text` | `CharSequence`

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