to top
Android APIs
public final class

CompletionInfo

extends Object
implements Parcelable
java.lang.Object
   ↳ android.view.inputmethod.CompletionInfo

Class Overview

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

Summary

[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<CompletionInfo> CREATOR Used to make this class parcelable.
Public Constructors
CompletionInfo(long id, int index, CharSequence text)
Create a simple completion with just text, no label.
CompletionInfo(long id, int index, CharSequence text, CharSequence label)
Create a full completion with both text and label.
Public Methods
int describeContents()
Describe the kinds of special objects contained in this Parcelable's marshalled representation.
long getId()
Return the abstract identifier for this completion, typically corresponding to the id associated with it in the original adapter.
CharSequence getLabel()
Return the user-visible label for the completion, or null if the plain text should be shown.
int getPosition()
Return the original position of this completion, typically corresponding to its position in the original adapter.
CharSequence getText()
Return the actual text associated with this completion.
String toString()
Returns a string containing a concise, human-readable description of this object.
void writeToParcel(Parcel dest, int flags)
Used to package this object into a Parcel.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<CompletionInfo> CREATOR

Since: API Level 3

Used to make this class parcelable.

Public Constructors

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

Since: API Level 3

Create a simple completion with just text, no label.

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

Since: API Level 3

Create a full completion with both text and label.

Public Methods

public int describeContents ()

Since: API Level 3

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

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

public long getId ()

Since: API Level 3

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

public CharSequence getLabel ()

Since: API Level 3

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.

public int getPosition ()

Since: API Level 3

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

public CharSequence getText ()

Since: API Level 3

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.

public String toString ()

Since: API Level 3

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

public void writeToParcel (Parcel dest, int flags)

Since: API Level 3

Used to package this object into a Parcel.

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