java.lang.Object | |
↳ | android.content.ClipData.Item |
Description of a single item in a ClippedData.
The types than an individual item can currently contain are:
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Create an Item consisting of a single block of (possibly styled) text.
|
||||||||||
|
Create an Item consisting of a single block of (possibly styled) text,
with an alternative HTML formatted representation.
|
||||||||||
|
Create an Item consisting of an arbitrary Intent.
|
||||||||||
|
Create an Item consisting of an arbitrary URI.
|
||||||||||
|
Create a complex Item, containing multiple representations of
text, Intent, and/or URI.
|
||||||||||
|
Create a complex Item, containing multiple representations of
text, HTML text, Intent, and/or URI.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
|
Turn this item into HTML text, regardless of the type of data it
actually contains.
|
||||||||||
|
Like
coerceToHtmlText(Context)
, but any text that would
be returned as HTML formatting will be returned as text with
style spans.
|
||||||||||
|
Turn this item into text, regardless of the type of data it
actually contains.
|
||||||||||
|
Retrieve the raw HTML text contained in this Item.
|
||||||||||
|
Retrieve the raw Intent contained in this Item.
|
||||||||||
|
Retrieve the raw text contained in this Item.
|
||||||||||
|
Retrieve the raw URI contained in this Item.
|
||||||||||
|
Returns a string containing a concise, human-readable description of this
object.
|
[Expand]
Inherited Methods
|
|||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
From class
java.lang.Object
|
Create an Item consisting of a single block of (possibly styled) text.
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 formated text into plain text.
Create an Item consisting of an arbitrary Intent.
Create an Item consisting of an arbitrary URI.
Create a complex Item, containing multiple representations of text, Intent, and/or 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 formated text into plain text.
Turn this item into HTML text, regardless of the type of data it actually contains.
The algorithm for deciding what text to return is:
getHtmlText()
is non-null, return that.
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.
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.
getIntent()
is non-null, convert that to an intent:
URI and return as an HTML link.
context | The caller's Context, from which its ContentResolver and other things can be retrieved. |
---|
Like
coerceToHtmlText(Context)
, but any text that would
be returned as HTML formatting will be returned as text with
style spans.
context | The caller's Context, from which its ContentResolver and other things can be retrieved. |
---|
Turn this item into text, regardless of the type of data it actually contains.
The algorithm for deciding what text to return is:
getText()
is non-null, return that.
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.
getIntent()
is non-null, convert that to an intent:
URI and return it.
context | The caller's Context, from which its ContentResolver and other things can be retrieved. |
---|
Retrieve the raw HTML text contained in this Item.
Returns a string containing a concise, human-readable description of this object. Subclasses are encouraged to override this method and provide an implementation that takes into account the object's type and data. The default implementation is equivalent to the following expression:
getClass().getName() + '@' + Integer.toHexString(hashCode())
See
Writing a useful
toString
method
if you intend implementing your own
toString
method.