Skip to content

Most visited

Recently visited

navigation
Added in API level 11

ClipDescription

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.

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.

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.

Inherited methods

From class java.lang.Object
From interface android.os.Parcelable

Constants

MIMETYPE_TEXT_HTML

Added in API level 16
String MIMETYPE_TEXT_HTML

The MIME type for a clip holding HTML text.

Constant Value: "text/html"

MIMETYPE_TEXT_INTENT

Added in API level 11
String MIMETYPE_TEXT_INTENT

The MIME type for a clip holding an Intent.

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

MIMETYPE_TEXT_PLAIN

Added in API level 11
String MIMETYPE_TEXT_PLAIN

The MIME type for a clip holding plain text.

Constant Value: "text/plain"

MIMETYPE_TEXT_URILIST

Added in API level 11
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"

Fields

CREATOR

Added in API level 11
Creator<ClipDescription> CREATOR

Public constructors

ClipDescription

Added in API level 11
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.

ClipDescription

Added in API level 11
ClipDescription (ClipDescription o)

Create a copy of a ClipDescription.

Parameters
o ClipDescription

Public methods

compareMimeTypes

Added in API level 11
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.

describeContents

Added in API level 11
int describeContents ()

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

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

filterMimeTypes

Added in API level 11
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.

getLabel

Added in API level 11
CharSequence getLabel ()

Return the label for this clip.

Returns
CharSequence

getMimeType

Added in API level 11
String getMimeType (int index)

Return one of the possible clip MIME types.

Parameters
index int
Returns
String

getMimeTypeCount

Added in API level 11
int getMimeTypeCount ()

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

Returns
int

hasMimeType

Added in API level 11
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.

toString

Added in API level 11
String toString ()

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
String a printable representation of this object.

writeToParcel

Added in API level 11
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_WRITE_RETURN_VALUE.
This site uses cookies to store your preferences for site-specific language and display options.

Hooray!

This class requires API level or higher

This doc is hidden because your selected API level for the documentation is . You can change the documentation API level with the selector above the left navigation.

For more information about specifying the API level your app requires, read Supporting Different Platform Versions.