Class Overview
Description of a single item in a ClippedData.
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
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Invoked when the garbage collector has detected that this instance is no longer reachable.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
Public Constructors
public
ClipData.Item
(CharSequence text)
Create an Item consisting of a single block of (possibly styled) text.
public
ClipData.Item
(Intent intent)
Create an Item consisting of an arbitrary Intent.
public
ClipData.Item
(Uri uri)
Create an Item consisting of an arbitrary URI.
public
ClipData.Item
(CharSequence text, Intent intent, Uri uri)
Create a complex Item, containing multiple representations of
text, intent, and/or URI.
Public Methods
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 returnit.
- Otherwise, return an empty string.
Parameters
context
| The caller's Context, from which its ContentResolver
and other things can be retrieved. |
Returns
- Returns the item's textual representation.
public
Intent
getIntent
()
Retrieve the raw Intent contained in this Item.
Retrieve the raw text contained in this Item.
public
Uri
getUri
()
Retrieve the raw URI contained in this Item.