# Print output for @column tags ?>
public
class
ClipDescription
extends Object
implements
Parcelable
java.lang.Object | |
↳ | android.content.ClipDescription |
Meta-data describing the contents of a ClipData
. Provides enough
information to know if you can handle the ClipData, but not the data
itself.
For more information about using the clipboard framework, read the Copy and Paste developer guide.
Constants | |
---|---|
String |
MIMETYPE_TEXT_HTML
The MIME type for a clip holding HTML text. |
String |
MIMETYPE_TEXT_INTENT
The MIME type for a clip holding an Intent. |
String |
MIMETYPE_TEXT_PLAIN
The MIME type for a clip holding plain text. |
String |
MIMETYPE_TEXT_URILIST
The MIME type for a clip holding one or more URIs. |
String |
MIMETYPE_UNKNOWN
The MIME type for data whose type is otherwise unknown. |
Inherited constants |
---|
Fields | |
---|---|
public
static
final
Creator<ClipDescription> |
CREATOR
|
Public constructors | |
---|---|
ClipDescription(CharSequence label, String[] mimeTypes)
Create a new clip. |
|
ClipDescription(ClipDescription o)
Create a copy of a ClipDescription. |
Public methods | |
---|---|
static
boolean
|
compareMimeTypes(String concreteType, String desiredType)
Helper to compare two MIME types, where one may be a pattern. |
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
String[]
|
filterMimeTypes(String mimeType)
Filter the clip description MIME types by the given MIME type. |
PersistableBundle
|
getExtras()
Retrieve extended data from the clip description. |
CharSequence
|
getLabel()
Return the label for this clip. |
String
|
getMimeType(int index)
Return one of the possible clip MIME types. |
int
|
getMimeTypeCount()
Return the number of MIME types the clip is available in. |
long
|
getTimestamp()
Return the timestamp at which the associated |
boolean
|
hasMimeType(String mimeType)
Check whether the clip description contains the given MIME type. |
void
|
setExtras(PersistableBundle extras)
Add extended data to the clip description. |
String
|
toString()
Returns a string representation of the object. |
void
|
writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
---|---|
public static final String MIMETYPE_TEXT_HTML
The MIME type for a clip holding HTML text.
Constant Value: "text/html"
public static final String MIMETYPE_TEXT_INTENT
The MIME type for a clip holding an Intent.
Constant Value: "text/vnd.android.intent"
public static final String MIMETYPE_TEXT_PLAIN
The MIME type for a clip holding plain text.
Constant Value: "text/plain"
public static final String MIMETYPE_TEXT_URILIST
The MIME type for a clip holding one or more URIs. This should be used for URIs that are meaningful to a user (such as an http: URI). It should not be used for a content: URI that references some other piece of data; in that case the MIME type should be the type of the referenced data.
Constant Value: "text/uri-list"
public static final String MIMETYPE_UNKNOWN
The MIME type for data whose type is otherwise unknown.
Per RFC 2046, the "application" media type is to be used for discrete data which do not fit in any of the other categories, and the "octet-stream" subtype is used to indicate that a body contains arbitrary binary data.
Constant Value: "application/octet-stream"
public ClipDescription (CharSequence label, String[] mimeTypes)
Create a new clip.
Parameters | |
---|---|
label |
CharSequence : Label to show to the user describing this clip. |
mimeTypes |
String : An array of MIME types this data is available as. |
public ClipDescription (ClipDescription o)
Create a copy of a ClipDescription.
Parameters | |
---|---|
o |
ClipDescription |
public static boolean compareMimeTypes (String concreteType, String desiredType)
Helper to compare two MIME types, where one may be a pattern.
Parameters | |
---|---|
concreteType |
String : A fully-specified MIME type. |
desiredType |
String : A desired MIME type that may be a pattern such as */*. |
Returns | |
---|---|
boolean |
Returns true if the two MIME types match. |
public int describeContents ()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of writeToParcel(android.os.Parcel, int)
,
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR
bit.
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled
by this Parcelable object instance.
Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
public String[] filterMimeTypes (String mimeType)
Filter the clip description MIME types by the given MIME type. Returns all MIME types in the clip that match the given MIME type.
Parameters | |
---|---|
mimeType |
String : The desired MIME type. May be a pattern. |
Returns | |
---|---|
String[] |
Returns an array of all matching MIME types. If there are no matching MIME types, null is returned. |
public PersistableBundle getExtras ()
Retrieve extended data from the clip description.
Returns | |
---|---|
PersistableBundle |
the bundle containing extended data previously set with
setExtras(android.os.PersistableBundle) , or null if no extras have been set. |
See also:
public String getMimeType (int index)
Return one of the possible clip MIME types.
Parameters | |
---|---|
index |
int |
Returns | |
---|---|
String |
public int getMimeTypeCount ()
Return the number of MIME types the clip is available in.
Returns | |
---|---|
int |
public long getTimestamp ()
Return the timestamp at which the associated ClipData
is copied to global clipboard
in the System#currentTimeMillis()
time base.
Returns | |
---|---|
long |
timestamp at which the associated ClipData is copied to global clipboard
or 0 if it is not copied to clipboard. |
public boolean hasMimeType (String mimeType)
Check whether the clip description contains the given MIME type.
Parameters | |
---|---|
mimeType |
String : The desired MIME type. May be a pattern. |
Returns | |
---|---|
boolean |
Returns true if one of the MIME types in the clip description matches the desired MIME type, else false. |
public void setExtras (PersistableBundle extras)
Add extended data to the clip description.
Parameters | |
---|---|
extras |
PersistableBundle |
See also:
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. |
public void writeToParcel (Parcel dest, int flags)
Flatten this object in to a Parcel.
Parameters | |
---|---|
dest |
Parcel : The Parcel in which the object should be written. |
flags |
int : Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE .
Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |