Added in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Ctors](https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#pubctors) \| [Methods](https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#inhmethods)

# SpellCheckerService.Session

*** ** * ** ***


`
public
static

abstract
class
SpellCheckerService.Session
`


`

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


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.service.textservice.SpellCheckerService.Session |

<br />

*** ** * ** ***

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

## Summary

| ### Public constructors ||
|---|---|
| ` https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#Session()() ` |

| ### Public methods ||
|---|---|
| ` https://developer.android.com/reference/android/os/Bundle` | ` https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#getBundle()() ` |
| ` https://developer.android.com/reference/java/lang/String` | ` https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#getLocale()() ` |
| ` int` | ` https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#getSupportedAttributes()() ` Returns result attributes supported for this session. |
| ` void` | ` https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#onCancel()() ` Request to abort all tasks executed in SpellChecker. |
| ` void` | ` https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#onClose()() ` Request to close this session. |
| ` abstract void` | ` https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#onCreate()() ` This is called after the class is initialized, at which point it knows it can call getLocale() etc... |
| ` https://developer.android.com/reference/android/view/textservice/SentenceSuggestionsInfo` | ` https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#onGetSentenceSuggestionsMultiple(android.view.textservice.TextInfo[],%20int)(https://developer.android.com/reference/android/view/textservice/TextInfo textInfos, int suggestionsLimit) ` Get sentence suggestions for specified texts in an array of TextInfo. |
| ` abstract https://developer.android.com/reference/android/view/textservice/SuggestionsInfo` | ` https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#onGetSuggestions(android.view.textservice.TextInfo,%20int)(https://developer.android.com/reference/android/view/textservice/TextInfo textInfo, int suggestionsLimit) ` Get suggestions for specified text in TextInfo. |
| ` https://developer.android.com/reference/android/view/textservice/SuggestionsInfo` | ` https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#onGetSuggestionsMultiple(android.view.textservice.TextInfo[],%20int,%20boolean)(https://developer.android.com/reference/android/view/textservice/TextInfo textInfos, int suggestionsLimit, boolean sequentialWords) ` A batch process of onGetSuggestions. |

| ### 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*. | ||

## Public constructors

### Session

```
public Session ()
```

<br />

<br />

## Public methods

### getBundle

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

```
public Bundle getBundle ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/os/Bundle` | Bundle for this session <br /> |

### getLocale

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

```
public String getLocale ()
```

<br />

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/lang/String` | Locale for this session <br /> |

### getSupportedAttributes

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

```
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 `https://developer.android.com/reference/android/view/textservice/SuggestionsInfo`.

<br />

| Returns ||
|---|---|
| `int` | The supported result attributes for this session. Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/view/textservice/SuggestionsInfo#RESULT_ATTR_IN_THE_DICTIONARY` - `https://developer.android.com/reference/android/view/textservice/SuggestionsInfo#RESULT_ATTR_LOOKS_LIKE_TYPO` - `https://developer.android.com/reference/android/view/textservice/SuggestionsInfo#RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS` - `https://developer.android.com/reference/android/view/textservice/SuggestionsInfo#RESULT_ATTR_LOOKS_LIKE_GRAMMAR_ERROR` - `https://developer.android.com/reference/android/view/textservice/SuggestionsInfo#RESULT_ATTR_DONT_SHOW_UI_FOR_SUGGESTIONS` |

### onCancel

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

```
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.

<br />

### onClose

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

```
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.

<br />

### onCreate

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

```
public abstract void onCreate ()
```

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

<br />

### onGetSentenceSuggestionsMultiple

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

```
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
`https://developer.android.com/reference/android/view/textservice/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.

<br />

| Parameters ||
|---|---|
| `textInfos` | `TextInfo`: an array of the text metadata <br /> |
| `suggestionsLimit` | `int`: the maximum number of suggestions to be returned <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/textservice/SentenceSuggestionsInfo` | an array of `https://developer.android.com/reference/android/view/textservice/SentenceSuggestionsInfo` returned by `https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#onGetSuggestions(android.view.textservice.TextInfo,%20int)` <br /> |

### onGetSuggestions

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

```
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.

<br />

| Parameters ||
|---|---|
| `textInfo` | `TextInfo`: the text metadata <br /> |
| `suggestionsLimit` | `int`: the maximum number of suggestions to be returned <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/textservice/SuggestionsInfo` | SuggestionsInfo which contains suggestions for textInfo <br /> |

### onGetSuggestionsMultiple

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

```
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.

<br />

| Parameters ||
|---|---|
| `textInfos` | `TextInfo`: an array of the text metadata <br /> |
| `suggestionsLimit` | `int`: the maximum number of suggestions to be returned <br /> |
| `sequentialWords` | `boolean`: true if textInfos can be treated as sequential words. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/view/textservice/SuggestionsInfo` | an array of `https://developer.android.com/reference/android/view/textservice/SentenceSuggestionsInfo` returned by `https://developer.android.com/reference/android/service/textservice/SpellCheckerService.Session#onGetSuggestions(android.view.textservice.TextInfo,%20int)` <br /> |