ContentInfo


public final class ContentInfo
extends Object implements Parcelable

java.lang.Object
   ↳ android.view.ContentInfo


Holds all the relevant data for a request to View#performReceiveContent.

Summary

Nested classes

class ContentInfo.Builder

Builder for ContentInfo

Constants

int FLAG_CONVERT_TO_PLAIN_TEXT

Flag requesting that the content should be converted to plain text prior to inserting.

int SOURCE_APP

Specifies that the operation was triggered by the app that contains the target view.

int SOURCE_AUTOFILL

Specifies that the operation was triggered by the autofill framework.

int SOURCE_CLIPBOARD

Specifies that the operation was triggered by a paste from the clipboard (e.g. "Paste" or "Paste as plain text" action in the insertion/selection menu).

int SOURCE_DRAG_AND_DROP

Specifies that the operation was triggered by the drag/drop framework.

int SOURCE_INPUT_METHOD

Specifies that the operation was triggered from the soft keyboard (also known as input method editor or IME).

int SOURCE_PROCESS_TEXT

Specifies that the operation was triggered by a result from a PROCESS_TEXT action in the selection menu.

Inherited constants

Fields

public static final Creator<ContentInfo> CREATOR

Creates ContentInfo instances from parcels.

Public methods

int describeContents()

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

ClipData getClip()

The data to be inserted.

Bundle getExtras()

Optional additional metadata.

int getFlags()

Optional flags that control the insertion behavior.

Uri getLinkUri()

Optional http/https URI for the content that may be provided by the IME.

int getSource()

The source of the operation.

String toString()

Returns a string representation of the object.

void writeToParcel(Parcel dest, int flags)

Writes this object into the given parcel.

Inherited methods

Constants

FLAG_CONVERT_TO_PLAIN_TEXT

Added in API level 31
public static final int FLAG_CONVERT_TO_PLAIN_TEXT

Flag requesting that the content should be converted to plain text prior to inserting.

Constant Value: 1 (0x00000001)

SOURCE_APP

Added in API level 31
public static final int SOURCE_APP

Specifies that the operation was triggered by the app that contains the target view.

Constant Value: 0 (0x00000000)

SOURCE_AUTOFILL

Added in API level 31
public static final int SOURCE_AUTOFILL

Specifies that the operation was triggered by the autofill framework. See https://developer.android.com/guide/topics/text/autofill for more info.

Constant Value: 4 (0x00000004)

SOURCE_CLIPBOARD

Added in API level 31
public static final int SOURCE_CLIPBOARD

Specifies that the operation was triggered by a paste from the clipboard (e.g. "Paste" or "Paste as plain text" action in the insertion/selection menu).

Constant Value: 1 (0x00000001)

SOURCE_DRAG_AND_DROP

Added in API level 31
public static final int SOURCE_DRAG_AND_DROP

Specifies that the operation was triggered by the drag/drop framework. See https://developer.android.com/guide/topics/ui/drag-drop for more info.

Constant Value: 3 (0x00000003)

SOURCE_INPUT_METHOD

Added in API level 31
public static final int SOURCE_INPUT_METHOD

Specifies that the operation was triggered from the soft keyboard (also known as input method editor or IME). See https://developer.android.com/guide/topics/text/image-keyboard for more info.

Constant Value: 2 (0x00000002)

SOURCE_PROCESS_TEXT

Added in API level 31
public static final int SOURCE_PROCESS_TEXT

Specifies that the operation was triggered by a result from a PROCESS_TEXT action in the selection menu.

Constant Value: 5 (0x00000005)

Fields

CREATOR

Added in API level 31
public static final Creator<ContentInfo> CREATOR

Creates ContentInfo instances from parcels.

Public methods

describeContents

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

getClip

Added in API level 31
public ClipData getClip ()

The data to be inserted.

Returns
ClipData This value cannot be null.

getExtras

Added in API level 31
public Bundle getExtras ()

Optional additional metadata. If the source is SOURCE_INPUT_METHOD, this will include the opts passed by the IME.

Returns
Bundle This value may be null.

getFlags

Added in API level 31
public int getFlags ()

Optional flags that control the insertion behavior. See FLAG_ constants.

Returns
int Value is either 0 or FLAG_CONVERT_TO_PLAIN_TEXT

getLinkUri

Added in API level 31
public Uri getLinkUri ()

Optional http/https URI for the content that may be provided by the IME. This is only populated if the source is SOURCE_INPUT_METHOD and if a non-empty linkUri was passed by the IME.

Returns
Uri This value may be null.

getSource

Added in API level 31
public int getSource ()

The source of the operation. See SOURCE_ constants. Future versions of Android may pass additional values.

Returns
int Value is SOURCE_APP, SOURCE_CLIPBOARD, SOURCE_INPUT_METHOD, SOURCE_DRAG_AND_DROP, SOURCE_AUTOFILL, or SOURCE_PROCESS_TEXT

toString

Added in API level 31
public String toString ()

Returns a string representation of the object.

Returns
String This value cannot be null.

writeToParcel

Added in API level 31
public void writeToParcel (Parcel dest, 
                int flags)

Writes this object into the given parcel.

Parameters
dest Parcel: The parcel to write into. This value cannot be null.

flags int: The flags to use for parceling.