SpellCheckerSession.SpellCheckerSessionParams.Builder


public static final class SpellCheckerSession.SpellCheckerSessionParams.Builder
extends Object

java.lang.Object
   ↳ android.view.textservice.SpellCheckerSession.SpellCheckerSessionParams.Builder


Builder of SpellCheckerSessionParams.

Summary

Public constructors

Builder()

Constructs a Builder.

Public methods

SpellCheckerSession.SpellCheckerSessionParams build()

Returns constructed SpellCheckerSession instance.

SpellCheckerSession.SpellCheckerSessionParams.Builder setExtras(Bundle extras)

Sets a bundle containing extra parameters for the spell checker.

SpellCheckerSession.SpellCheckerSessionParams.Builder setLocale(Locale locale)

Sets the locale in which the spell checker should operate.

SpellCheckerSession.SpellCheckerSessionParams.Builder setShouldReferToSpellCheckerLanguageSettings(boolean shouldReferToSpellCheckerLanguageSettings)

Sets whether or not the user's spell checker language settings should be used to determine spell checker locale.

SpellCheckerSession.SpellCheckerSessionParams.Builder setSupportedAttributes(int supportedAttributes)

Sets a bitmask of SuggestionsInfo attributes that the spell checker can set in SuggestionsInfo it returns.

Inherited methods

Public constructors

Builder

Added in API level 31
public Builder ()

Constructs a Builder.

Public methods

build

Added in API level 31
public SpellCheckerSession.SpellCheckerSessionParams build ()

Returns constructed SpellCheckerSession instance.

Before calling this method, either setLocale(java.util.Locale) should be called with a non-null locale or setShouldReferToSpellCheckerLanguageSettings(boolean) should be called with true.

Returns
SpellCheckerSession.SpellCheckerSessionParams

setExtras

Added in API level 31
public SpellCheckerSession.SpellCheckerSessionParams.Builder setExtras (Bundle extras)

Sets a bundle containing extra parameters for the spell checker.

This bundle can be used to pass implementation-specific parameters to the SpellCheckerService implementation.

Parameters
extras Bundle: This value cannot be null.

Returns
SpellCheckerSession.SpellCheckerSessionParams.Builder This value cannot be null.

setLocale

Added in API level 31
public SpellCheckerSession.SpellCheckerSessionParams.Builder setLocale (Locale locale)

Sets the locale in which the spell checker should operate.

Parameters
locale Locale: This value may be null.

Returns
SpellCheckerSession.SpellCheckerSessionParams.Builder This value cannot be null.

setShouldReferToSpellCheckerLanguageSettings

Added in API level 31
public SpellCheckerSession.SpellCheckerSessionParams.Builder setShouldReferToSpellCheckerLanguageSettings (boolean shouldReferToSpellCheckerLanguageSettings)

Sets whether or not the user's spell checker language settings should be used to determine spell checker locale.

If shouldReferToSpellCheckerLanguageSettings is true, the exact way of determining spell checker locale differs based on locale specified in setLocale(java.util.Locale). If shouldReferToSpellCheckerLanguageSettings is true and locale is null, the locale specified in Settings will be used. If shouldReferToSpellCheckerLanguageSettings is true and locale is not null, SpellCheckerSession can be created only when the locale specified in Settings is the same as locale. Exceptionally, if shouldReferToSpellCheckerLanguageSettings is true and locale is language only (e.g. "en"), the specified locale in Settings (e.g. "en_US") will be used.

Parameters
shouldReferToSpellCheckerLanguageSettings boolean

Returns
SpellCheckerSession.SpellCheckerSessionParams.Builder

See also:

setSupportedAttributes

Added in API level 31
public SpellCheckerSession.SpellCheckerSessionParams.Builder setSupportedAttributes (int supportedAttributes)

Sets a bitmask of SuggestionsInfo attributes that the spell checker can set in SuggestionsInfo it returns.

Parameters
supportedAttributes int: Value is either 0 or a combination of SuggestionsInfo.RESULT_ATTR_IN_THE_DICTIONARY, SuggestionsInfo.RESULT_ATTR_LOOKS_LIKE_TYPO, SuggestionsInfo.RESULT_ATTR_HAS_RECOMMENDED_SUGGESTIONS, SuggestionsInfo.RESULT_ATTR_LOOKS_LIKE_GRAMMAR_ERROR, and SuggestionsInfo.RESULT_ATTR_DONT_SHOW_UI_FOR_SUGGESTIONS

Returns
SpellCheckerSession.SpellCheckerSessionParams.Builder This value cannot be null.