# Print output for @column tags ?>
Developers

- Design
- Develop
- Distribute

Developer Console

## Most visited

## Recently visited

## Results for

Summary: Ctors | Methods | Inherited Methods

# ClipData.Item

`public static class ClipData.Item`
`extends Object` ``

java.lang.Object
↳ | android.content.ClipData.Item

Description of a single item in a ClipData.

The types than an individual item can currently contain are:

- Text: a basic string of text. This is actually a CharSequence, so it can be formatted text supported by corresponding Android built-in style spans. (Custom application spans are not supported and will be stripped when transporting through the clipboard.)
- Intent: an arbitrary Intent object. A typical use is the shortcut to create when pasting a clipped item on to the home screen.
- Uri: a URI reference. This may be any URI (such as an http: URI representing a bookmark), however it is often a content: URI. Using content provider references as clips like this allows an application to share complex or large clips through the standard content provider facilities.

## Summary

### Public constructors
`Item(CharSequence text)` Create an Item consisting of a single block of (possibly styled) text.
`Item(CharSequence text, String htmlText)` Create an Item consisting of a single block of (possibly styled) text, with an alternative HTML formatted representation.
`Item(Intent intent)` Create an Item consisting of an arbitrary Intent.
`Item(Uri uri)` Create an Item consisting of an arbitrary URI.
`Item(CharSequence text, Intent intent, Uri uri)` Create a complex Item, containing multiple representations of text, Intent, and/or URI.
`Item(CharSequence text, String htmlText, Intent intent, Uri uri)` Create a complex Item, containing multiple representations of text, HTML text, Intent, and/or URI.

### Public methods
`String` | `coerceToHtmlText(Context context)` Turn this item into HTML text, regardless of the type of data it actually contains.
`CharSequence` | `coerceToStyledText(Context context)` Like `coerceToHtmlText(android.content.Context)`, but any text that would be returned as HTML formatting will be returned as text with style spans.
`CharSequence` | `coerceToText(Context context)` Turn this item into text, regardless of the type of data it actually contains.
`String` | `getHtmlText()` Retrieve the raw HTML text contained in this Item.
`Intent` | `getIntent()` Retrieve the raw Intent contained in this Item.
`CharSequence` | `getText()` Retrieve the raw text contained in this Item.
`TextLinks` | `getTextLinks()` Returns the results of text classification run on the raw text contained in this item, if it was performed, and if any entities were found in the text.
`Uri` | `getUri()` Retrieve the raw URI contained in this Item.
`String` | `toString()` Returns a string representation of the object.

### 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 constructors

### Item

    public Item (CharSequence text)

Create an Item consisting of a single block of (possibly styled) text.

Parameters
`text` | `CharSequence`

### Item

    public Item (CharSequence text,
                    String htmlText)

Create an Item consisting of a single block of (possibly styled) text, with an alternative HTML formatted representation. You must supply a plain text representation in addition to HTML text; coercion will not be done from HTML formatted text into plain text.

Warning: Use content: URI for sharing large clip data. ClipData.Item doesn't accept an HTML text if it's larger than 800KB.

Parameters
`text` | `CharSequence`
`htmlText` | `String`

### Item

    public Item (Intent intent)

Create an Item consisting of an arbitrary Intent.

Parameters
`intent` | `Intent`

### Item

    public Item (Uri uri)

Create an Item consisting of an arbitrary URI.

Parameters
`uri` | `Uri`

### Item

    public Item (CharSequence text,
                    Intent intent,
                    Uri uri)

Create a complex Item, containing multiple representations of text, Intent, and/or URI.

Parameters
`text` | `CharSequence`
`intent` | `Intent`
`uri` | `Uri`

### Item

    public Item (CharSequence text,
                    String htmlText,
                    Intent intent,
                    Uri uri)

Create a complex Item, containing multiple representations of text, HTML text, Intent, and/or URI. If providing HTML text, you must supply a plain text representation as well; coercion will not be done from HTML formatted text into plain text.

Parameters
`text` | `CharSequence`
`htmlText` | `String`
`intent` | `Intent`
`uri` | `Uri`

## Public methods

### coerceToHtmlText

    public String coerceToHtmlText (Context context)

Turn this item into HTML text, regardless of the type of data it actually contains.

The algorithm for deciding what text to return is:

- If `getHtmlText()` is non-null, return that.
- If `getText()` is non-null, return that, converting to valid HTML text. If this text contains style spans, `Html.toHtml(Spanned)` is used to convert them to HTML formatting.
- If `getUri()` is non-null, try to retrieve its data as a text stream from its content provider. If the provider can supply text/html data, that will be preferred and returned as-is. Otherwise, any text/* data will be returned and escaped to HTML. If it is not a content: URI or the content provider does not supply a text representation, HTML text containing a link to the URI will be returned.
- If `getIntent()` is non-null, convert that to an intent: URI and return as an HTML link.
- Otherwise, return an empty string.

Parameters
`context` | `Context`: The caller's Context, from which its ContentResolver and other things can be retrieved.

Returns
`String` | Returns the item's representation as HTML text.

### coerceToStyledText

    public CharSequence coerceToStyledText (Context context)

Like `coerceToHtmlText(android.content.Context)`, but any text that would be returned as HTML formatting will be returned as text with style spans.

Parameters
`context` | `Context`: The caller's Context, from which its ContentResolver and other things can be retrieved.

Returns
`CharSequence` | Returns the item's textual representation.

### coerceToText

    public CharSequence coerceToText (Context context)

Turn this item into text, regardless of the type of data it actually contains.

The algorithm for deciding what text to return is:

- If `getText()` is non-null, return that.
- If `getUri()` is non-null, try to retrieve its data as a text stream from its content provider. If this succeeds, copy the text into a String and return it. If it is not a content: URI or the content provider does not supply a text representation, return the raw URI as a string.
- If `getIntent()` is non-null, convert that to an intent: URI and return it.
- Otherwise, return an empty string.

Parameters
`context` | `Context`: The caller's Context, from which its ContentResolver and other things can be retrieved.

Returns
`CharSequence` | Returns the item's textual representation.

### getHtmlText

    public String getHtmlText ()

Retrieve the raw HTML text contained in this Item.

Returns
`String` |

### getIntent

    public Intent getIntent ()

Retrieve the raw Intent contained in this Item.

Returns
`Intent` |

### getText

    public CharSequence getText ()

Retrieve the raw text contained in this Item.

Returns
`CharSequence` |

### getTextLinks

    public TextLinks getTextLinks ()

Returns the results of text classification run on the raw text contained in this item, if it was performed, and if any entities were found in the text. Classification is generally only performed on the first item in clip data, and only if the text is below a certain length.

Returns `null` if classification was not performed, or if no entities were found in the text.

Returns
`TextLinks` |

See also:

- `ClipDescription.getConfidenceScore(String)`

### getUri

    public Uri getUri ()

Retrieve the raw URI contained in this Item.

Returns
`Uri` |

### toString

    public String toString ()

Returns a string representation of the object. In general, the `toString` method returns a string that "textually represents" this object. The result should be a concise but informative representation that is easy for a person to read. It is recommended that all subclasses override this method.

The `toString` method for class `Object` returns a string consisting of the name of the class of which the object is an instance, the at-sign character ``@`', and the unsigned hexadecimal representation of the hash code of the object. In other words, this method returns a string equal to the value of:

>      getClass().getName() + '@' + Integer.toHexString(hashCode())

Returns
`String` | a string representation of the object.

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