to top
Android APIs
public class

ClipDescription

extends Object
implements Parcelable
java.lang.Object
   ↳ android.content.ClipDescription

Class Overview

Meta-data describing the contents of a ClipData. Provides enough information to know if you can handle the ClipData, but not the data itself.

Developer Guides

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

Summary

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.
[Expand]
Inherited Constants
From interface android.os.Parcelable
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's marshalled representation.
String[] filterMimeTypes(String mimeType)
Filter the clip description MIME types by the given MIME type.
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.
boolean hasMimeType(String mimeType)
Check whether the clip description contains the given MIME type.
String toString()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Constants

public static final String MIMETYPE_TEXT_HTML

Added in API level 16

The MIME type for a clip holding HTML text.

Constant Value: "text/html"

public static final String MIMETYPE_TEXT_INTENT

Added in API level 11

The MIME type for a clip holding an Intent.

Constant Value: "text/vnd.android.intent"

public static final String MIMETYPE_TEXT_PLAIN

Added in API level 11

The MIME type for a clip holding plain text.

Constant Value: "text/plain"

public static final String MIMETYPE_TEXT_URILIST

Added in API level 11

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"

Fields

public static final Creator<ClipDescription> CREATOR

Added in API level 11

Public Constructors

public ClipDescription (CharSequence label, String[] mimeTypes)

Added in API level 11

Create a new clip.

Parameters
label Label to show to the user describing this clip.
mimeTypes An array of MIME types this data is available as.

public ClipDescription (ClipDescription o)

Added in API level 11

Create a copy of a ClipDescription.

Public Methods

public static boolean compareMimeTypes (String concreteType, String desiredType)

Added in API level 11

Helper to compare two MIME types, where one may be a pattern.

Parameters
concreteType A fully-specified MIME type.
desiredType A desired MIME type that may be a pattern such as */*.
Returns
  • Returns true if the two MIME types match.

public int describeContents ()

Added in API level 11

Describe the kinds of special objects contained in this Parcelable's marshalled representation.

Returns
  • a bitmask indicating the set of special object types marshalled by the Parcelable.

public String[] filterMimeTypes (String mimeType)

Added in API level 11

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 The desired MIME type. May be a pattern.
Returns
  • Returns an array of all matching MIME types. If there are no matching MIME types, null is returned.

public CharSequence getLabel ()

Added in API level 11

Return the label for this clip.

public String getMimeType (int index)

Added in API level 11

Return one of the possible clip MIME types.

public int getMimeTypeCount ()

Added in API level 11

Return the number of MIME types the clip is available in.

public boolean hasMimeType (String mimeType)

Added in API level 11

Check whether the clip description contains the given MIME type.

Parameters
mimeType The desired MIME type. May be a pattern.
Returns
  • Returns true if one of the MIME types in the clip description matches the desired MIME type, else false.

public String toString ()

Added in API level 11

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.

Returns
  • a printable representation of this object.

public void writeToParcel (Parcel dest, int flags)

Added in API level 11

Flatten this object in to a Parcel.

Parameters
dest The Parcel in which the object should be written.
flags Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE.