Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Inherited Constants](https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#inhconstants) \| [Fields](https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#lfields) \| [Ctors](https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#pubctors) \| [Methods](https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#inhmethods)

# CompletionInfo

*** ** * ** ***


`
public

final

class
CompletionInfo
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


implements

https://developer.android.com/reference/android/os/Parcelable


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.view.inputmethod.CompletionInfo |

<br />

*** ** * ** ***

Information about a single text completion that an editor has reported to
an input method.

This class encapsulates a completion offered by an application
that wants it to be presented to the user by the IME. Usually, apps
present their completions directly in a scrolling list for example
(UI developers will usually use or extend
`https://developer.android.com/reference/android/widget/AutoCompleteTextView` to implement this).
However, in some cases, the editor may not be visible, as in the
case in extract mode where the IME has taken over the full
screen. In this case, the editor can choose to send their
completions to the IME for display.

Most applications who want to send completions to an IME should use
`https://developer.android.com/reference/android/widget/AutoCompleteTextView` as this class makes this
process easy. In this case, the application would not have to deal directly
with this class.

An application who implements its own editor and wants direct control
over this would create an array of CompletionInfo objects, and send it to the IME using
`https://developer.android.com/reference/android/view/inputmethod/InputMethodManager#displayCompletions(android.view.View,%20android.view.inputmethod.CompletionInfo[])`.
The IME would present the completions however they see fit, and
call back to the editor through
`https://developer.android.com/reference/android/view/inputmethod/InputConnection#commitCompletion(android.view.inputmethod.CompletionInfo)`.
The application can then pick up the commit event by overriding
`https://developer.android.com/reference/android/widget/TextView#onCommitCompletion(android.view.inputmethod.CompletionInfo)`.

## Summary

### Inherited constants

From interface `https://developer.android.com/reference/android/os/Parcelable` `int` `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR`

Descriptor bit used with `https://developer.android.com/reference/android/os/Parcelable#describeContents()`: indicates that
the Parcelable object's flattened representation includes a file descriptor.


`int` `https://developer.android.com/reference/android/os/Parcelable#PARCELABLE_WRITE_RETURN_VALUE`

Flag for use with `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`: the object being written
is a return value, that is the result of a function such as
"`Parcelable someFunction()`",
"`void someFunction(out Parcelable)`", or
"`void someFunction(inout Parcelable)`".


| ### Fields ||
|---|---|
| ` public static final https://developer.android.com/reference/android/os/Parcelable.Creator<https://developer.android.com/reference/android/view/inputmethod/CompletionInfo>` | `https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#CREATOR` Used to make this class parcelable. |

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#CompletionInfo(long,%20int,%20java.lang.CharSequence)(long id, int index, https://developer.android.com/reference/java/lang/CharSequence text) ` Create a simple completion with just text, no label. |
| ` https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#CompletionInfo(long,%20int,%20java.lang.CharSequence,%20java.lang.CharSequence)(long id, int index, https://developer.android.com/reference/java/lang/CharSequence text, https://developer.android.com/reference/java/lang/CharSequence label) ` Create a full completion with both text and label. |

| ### Public methods ||
|---|---|
| ` int` | ` https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#describeContents()() ` Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
| ` long` | ` https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#getId()() ` Return the abstract identifier for this completion, typically corresponding to the id associated with it in the original adapter. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#getLabel()() ` Return the user-visible label for the completion, or null if the plain text should be shown. |
| ` int` | ` https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#getPosition()() ` Return the original position of this completion, typically corresponding to its position in the original adapter. |
| ` https://developer.android.com/reference/java/lang/CharSequence` | ` https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#getText()() ` Return the actual text associated with this completion. |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#toString()() ` Returns a string representation of the object. |
| ` void` | ` https://developer.android.com/reference/android/view/inputmethod/CompletionInfo#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags) ` Used to package this object into a `https://developer.android.com/reference/android/os/Parcel`. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


From interface `

https://developer.android.com/reference/android/os/Parcelable

` `
abstract


int` `
https://developer.android.com/reference/android/os/Parcelable#describeContents()()
`

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


`
abstract


void` `
https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)(https://developer.android.com/reference/android/os/Parcel dest, int flags)
`

Flatten this object in to a Parcel.


## Fields

### CREATOR

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final Creator<CompletionInfo> CREATOR
```

Used to make this class parcelable.

<br />

## Public constructors

### CompletionInfo

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CompletionInfo (long id, 
                int index, 
                CharSequence text)
```

Create a simple completion with just text, no label.

<br />

| Parameters ||
|---|---|
| `id` | `long`: An id that get passed as is (to the editor's discretion) <br /> |
| `index` | `int`: An index that get passed as is. Typically this is the index in the list of completions inside the editor. <br /> |
| `text` | `CharSequence`: The text that should be inserted into the editor when this completion is chosen. <br /> |

### CompletionInfo

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CompletionInfo (long id, 
                int index, 
                CharSequence text, 
                CharSequence label)
```

Create a full completion with both text and label. The text is
what will get inserted into the editor, while the label is what
the IME should display. If they are the same, use the version
of the constructor without a \`label' argument.

<br />

| Parameters ||
|---|---|
| `id` | `long`: An id that get passed as is (to the editor's discretion) <br /> |
| `index` | `int`: An index that get passed as is. Typically this is the index in the list of completions inside the editor. <br /> |
| `text` | `CharSequence`: The text that should be inserted into the editor when this completion is chosen. <br /> |
| `label` | `CharSequence`: The text that the IME should be showing among the completions list. <br /> |

## Public methods

### describeContents

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
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 `https://developer.android.com/reference/android/os/Parcelable#writeToParcel(android.os.Parcel,%20int)`,
the return value of this method must include the
`https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` bit.

<br />

| Returns ||
|---|---|
| `int` | a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either `0` or - `https://developer.android.com/reference/android/os/Parcelable#CONTENTS_FILE_DESCRIPTOR` |

### getId

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public long getId ()
```

Return the abstract identifier for this completion, typically
corresponding to the id associated with it in the original adapter.

<br />

| Returns ||
|---|---|
| `long` | <br /> |

### getLabel

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getLabel ()
```

Return the user-visible label for the completion, or null if the plain
text should be shown. If non-null, this will be what the user sees as
the completion option instead of the actual text.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | <br /> |

### getPosition

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getPosition ()
```

Return the original position of this completion, typically
corresponding to its position in the original adapter.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### getText

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public CharSequence getText ()
```

Return the actual text associated with this completion. This is the
real text that will be inserted into the editor if the user selects it.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/CharSequence` | <br /> |

### toString

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public String toString ()
```

Returns a string representation of the object.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | a string representation of the object. <br /> |

### writeToParcel

Added in [API level 3](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void writeToParcel (Parcel dest, 
                int flags)
```

Used to package this object into a `https://developer.android.com/reference/android/os/Parcel`.

<br />

| Parameters ||
|---|---|
| `dest` | `Parcel`: The `https://developer.android.com/reference/android/os/Parcel` to be written. <br /> |
| `flags` | `int`: The flags used for parceling. <br /> |