Added in API level 3

CompletionInfo


class CompletionInfo : Parcelable
kotlin.Any
   ↳ android.view.inputmethod.CompletionInfo

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 {@see 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 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 android.view.inputmethod.InputMethodManager#displayCompletions(View,android.view.inputmethod.CompletionInfo[]). The IME would present the completions however they see fit, and call back to the editor through InputConnection#commitCompletion(CompletionInfo). The application can then pick up the commit event by overriding android.widget.TextView#onCommitCompletion(CompletionInfo).

Summary

Inherited constants
Public constructors
CompletionInfo(id: Long, index: Int, text: CharSequence!)

Create a simple completion with just text, no label.

CompletionInfo(id: Long, index: Int, text: CharSequence!, label: CharSequence!)

Create a full completion with both text and label.

Public methods
Int

Long

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

CharSequence!

Return the user-visible label for the completion, or null if the plain text should be shown.

Int

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

CharSequence!

Return the actual text associated with this completion.

String

Unit
writeToParcel(dest: Parcel, flags: Int)

Used to package this object into a Parcel.

Properties
static Parcelable.Creator<CompletionInfo!>

Used to make this class parcelable.

Public constructors

CompletionInfo

Added in API level 3
CompletionInfo(
    id: Long,
    index: Int,
    text: CharSequence!)

Create a simple completion with just text, no label.

Parameters
id Long: An id that get passed as is (to the editor's discretion)
index Int: An index that get passed as is. Typically this is the index in the list of completions inside the editor.
text CharSequence!: The text that should be inserted into the editor when this completion is chosen.

CompletionInfo

Added in API level 3
CompletionInfo(
    id: Long,
    index: Int,
    text: CharSequence!,
    label: CharSequence!)

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.

Parameters
id Long: An id that get passed as is (to the editor's discretion)
index Int: An index that get passed as is. Typically this is the index in the list of completions inside the editor.
text CharSequence!: The text that should be inserted into the editor when this completion is chosen.
label CharSequence!: The text that the IME should be showing among the completions list.

Public methods

describeContents

Added in API level 3
fun describeContents(): Int
Return
Int a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or android.os.Parcelable#CONTENTS_FILE_DESCRIPTOR

getId

Added in API level 3
fun getId(): Long

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

getLabel

Added in API level 3
fun getLabel(): CharSequence!

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.

getPosition

Added in API level 3
fun getPosition(): Int

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

getText

Added in API level 3
fun getText(): CharSequence!

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.

toString

Added in API level 3
fun toString(): String
Return
String a string representation of the object.

writeToParcel

Added in API level 3
fun writeToParcel(
    dest: Parcel,
    flags: Int
): Unit

Used to package this object into a Parcel.

Parameters
dest Parcel: The Parcel to be written.
flags Int: The flags used for parceling.

Properties

CREATOR

Added in API level 3
static val CREATOR: Parcelable.Creator<CompletionInfo!>

Used to make this class parcelable.