Save the date! Android Dev Summit is coming to Sunnyvale, CA on Oct 23-24, 2019.

TextClassificationManager

class TextClassificationManager
kotlin.Any
   ↳ androidx.textclassifier.TextClassificationManager

Class to handle the creation of TextClassifier.

Summary

Public methods
TextClassifier

Returns the text classifier set through setTextClassifier(TextClassifier), a default text classifier is returned if it is not ever set, or a null is set.

Unit
setTextClassifier(@Nullable textClassifier: TextClassifier?)

Sets a preferred text classifier.

TextClassifier

Returns the default text classifier provided by this library.

static TextClassificationManager!
of(@NonNull context: Context)

Returns an instance of TextClassificationManager for the specified context.

Public methods

getTextClassifier

@NonNull fun getTextClassifier(): TextClassifier

Returns the text classifier set through setTextClassifier(TextClassifier), a default text classifier is returned if it is not ever set, or a null is set.

If you are implementing a text classifier, and want to delegate requests to the default text classifier provided by this library, you may want to use getDefaultTextClassifier() instead.

setTextClassifier

fun setTextClassifier(@Nullable textClassifier: TextClassifier?): Unit

Sets a preferred text classifier.

To turn off the feature completely, you can set a TextClassifier#NO_OP. If null is set, default text classifier is used.

Note that the given text classifier is only set to this instance of the TextClassificationManager.

getDefaultTextClassifier

@NonNull fun getDefaultTextClassifier(): TextClassifier

Returns the default text classifier provided by this library.

This is mainly for text classifier implementation to delegate the request to the default text classifier. Otherwise, in most cases, you shuold consider getTextClassifier() instead.

Note that the returned text classifier should be only used within the same context that is passed to TextClassificationManager#of(Context).

of

static fun of(@NonNull context: Context): TextClassificationManager!

Returns an instance of TextClassificationManager for the specified context. Each context has its own TextClassificationManager.