SpellCheckerService.Session


public static abstract class SpellCheckerService.Session
extends Object

java.lang.Object
   ↳ android.service.textservice.SpellCheckerService.Session


This abstract class should be overridden by a concrete implementation of a spell checker.

Summary

Public constructors

Session()

Public methods

Bundle getBundle()
String getLocale()
int getSupportedAttributes()

Returns result attributes supported for this session.

void onCancel()

Request to abort all tasks executed in SpellChecker.

void onClose()

Request to close this session.

abstract void onCreate()

This is called after the class is initialized, at which point it knows it can call getLocale() etc...

SentenceSuggestionsInfo[] onGetSentenceSuggestionsMultiple(TextInfo[] textInfos, int suggestionsLimit)

Get sentence suggestions for specified texts in an array of TextInfo.

abstract SuggestionsInfo onGetSuggestions(TextInfo textInfo, int suggestionsLimit)

Get suggestions for specified text in TextInfo.

SuggestionsInfo[] onGetSuggestionsMultiple(TextInfo[] textInfos, int suggestionsLimit, boolean sequentialWords)

A batch process of onGetSuggestions.

Inherited methods

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

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

void finalize()

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

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

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

final void notifyAll()

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

String toString()

Returns a string representation of the object.

final void wait(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 wait(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 wait()

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

Public constructors

Session

public Session ()

Public methods

getBundle

Added in API level 14
public Bundle getBundle ()

Returns
Bundle Bundle for this session

getLocale

Added in API level 14
public String getLocale ()

Returns
String Locale for this session

getSupportedAttributes

Added in API level 31
public int getSupportedAttributes ()

Returns result attributes supported for this session.

The session implementation should not set attributes that are not included in the return value of getSupportedAttributes() when creating SuggestionsInfo.

onCancel

Added in API level 14
public void onCancel ()

Request to abort all tasks executed in SpellChecker. This function will run on the incoming IPC thread. So, this is not called on the main thread, but will be called in series on another thread.

onClose

Added in API level 15
public void onClose ()

Request to close this session. This function will run on the incoming IPC thread. So, this is not called on the main thread, but will be called in series on another thread.

onCreate

Added in API level 14
public abstract void onCreate ()

This is called after the class is initialized, at which point it knows it can call getLocale() etc...

onGetSentenceSuggestionsMultiple

Added in API level 16
public SentenceSuggestionsInfo[] onGetSentenceSuggestionsMultiple (TextInfo[] textInfos, 
                int suggestionsLimit)

Get sentence suggestions for specified texts in an array of TextInfo. The default implementation splits the input text to words and returns SentenceSuggestionsInfo which contains suggestions for each word. This function will run on the incoming IPC thread. So, this is not called on the main thread, but will be called in series on another thread. When you override this method, make sure that suggestionsLimit is applied to suggestions that share the same start position and length.

Parameters
textInfos TextInfo: an array of the text metadata

suggestionsLimit int: the maximum number of suggestions to be returned

onGetSuggestions

Added in API level 14
public abstract SuggestionsInfo onGetSuggestions (TextInfo textInfo, 
                int suggestionsLimit)

Get suggestions for specified text in TextInfo. This function will run on the incoming IPC thread. So, this is not called on the main thread, but will be called in series on another thread.

Parameters
textInfo TextInfo: the text metadata

suggestionsLimit int: the maximum number of suggestions to be returned

Returns
SuggestionsInfo SuggestionsInfo which contains suggestions for textInfo

onGetSuggestionsMultiple

Added in API level 14
public SuggestionsInfo[] onGetSuggestionsMultiple (TextInfo[] textInfos, 
                int suggestionsLimit, 
                boolean sequentialWords)

A batch process of onGetSuggestions. This function will run on the incoming IPC thread. So, this is not called on the main thread, but will be called in series on another thread.

Parameters
textInfos TextInfo: an array of the text metadata

suggestionsLimit int: the maximum number of suggestions to be returned

sequentialWords boolean: true if textInfos can be treated as sequential words.

With the ability to publish rapidly to over 2 billion active Android devices, Google Play helps you grow a global audience for your apps and games and earn revenue.

Updated Jan 27, 2025

With the ability to publish rapidly to over 2 billion active Android devices, Google Play helps you grow a global audience for your apps and games and earn revenue.

Updated Dec 3, 2024

Android Studio 2021.3.1 Closed Issues

Updated Dec 13, 2024