public class ClipDescription extends Object implements Parcelable
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.
Parcelable.ClassLoaderCreator<T>, Parcelable.Creator<T>
Modifier and Type | Field and Description |
---|---|
static Parcelable.Creator<ClipDescription> |
CREATOR |
static String |
EXTRA_TARGET_COMPONENT_NAME
The name of the extra used to define a component name when copying/dragging
an app icon from Launcher.
|
static String |
EXTRA_USER_SERIAL_NUMBER
The name of the extra used to define a user serial number when copying/dragging
an app icon from Launcher.
|
static String |
MIMETYPE_TEXT_HTML
The MIME type for a clip holding HTML text.
|
static String |
MIMETYPE_TEXT_INTENT
The MIME type for a clip holding an Intent.
|
static String |
MIMETYPE_TEXT_PLAIN
The MIME type for a clip holding plain text.
|
static String |
MIMETYPE_TEXT_URILIST
The MIME type for a clip holding one or more URIs.
|
CONTENTS_FILE_DESCRIPTOR, PARCELABLE_ELIDE_DUPLICATES, PARCELABLE_WRITE_RETURN_VALUE
Constructor and Description |
---|
ClipDescription(CharSequence label,
String[] mimeTypes)
Create a new clip.
|
ClipDescription(ClipDescription o)
Create a copy of a ClipDescription.
|
Modifier and Type | Method and Description |
---|---|
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.
|
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.
|
boolean |
toShortString(StringBuilder b) |
boolean |
toShortStringTypesOnly(StringBuilder b) |
String |
toString()
Returns a string representation of the object.
|
void |
validate() |
void |
writeToParcel(Parcel dest,
int flags)
Flatten this object in to a Parcel.
|
public static final String MIMETYPE_TEXT_PLAIN
public static final String MIMETYPE_TEXT_HTML
public static final String MIMETYPE_TEXT_URILIST
public static final String MIMETYPE_TEXT_INTENT
public static final String EXTRA_TARGET_COMPONENT_NAME
Type: String
Use ComponentName.unflattenFromString(String)
and ComponentName.flattenToString()
to convert the extra value
to/from ComponentName
.
public static final String EXTRA_USER_SERIAL_NUMBER
Type: long
public static final Parcelable.Creator<ClipDescription> CREATOR
public ClipDescription(CharSequence label, String[] mimeTypes)
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)
public static boolean compareMimeTypes(String concreteType, String desiredType)
concreteType
- A fully-specified MIME type.desiredType
- A desired MIME type that may be a pattern such as */*.public CharSequence getLabel()
public boolean hasMimeType(String mimeType)
mimeType
- The desired MIME type. May be a pattern.public String[] filterMimeTypes(String mimeType)
mimeType
- The desired MIME type. May be a pattern.public int getMimeTypeCount()
public String getMimeType(int index)
public PersistableBundle getExtras()
setExtras(PersistableBundle)
, or null if no extras have been set.setExtras(PersistableBundle)
public void setExtras(PersistableBundle extras)
getExtras()
public void validate()
public String toString()
Object
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())
public boolean toShortString(StringBuilder b)
public boolean toShortStringTypesOnly(StringBuilder b)
public int describeContents()
Parcelable
Parcelable.writeToParcel(Parcel, int)
,
the return value of this method must include the
Parcelable.CONTENTS_FILE_DESCRIPTOR
bit.describeContents
in interface Parcelable
Parcelable.CONTENTS_FILE_DESCRIPTOR
public void writeToParcel(Parcel dest, int flags)
Parcelable
writeToParcel
in interface Parcelable
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.PARCELABLE_WRITE_RETURN_VALUE
.