# Text.TextBlock

public static class **Text.TextBlock** extends [Object](https://developer.android.com/reference/java/lang/Object.html)  
A block of text (think of it as a paragraph) as deemed by the OCR engine.

### Public Method Summary

|---|---|
| [Rect](https://developer.android.com/reference/android/graphics/Rect.html) | [getBoundingBox](https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.TextBlock#getBoundingBox())() Returns the axis-aligned bounding rectangle of the detected text. |
| [Point\[\]](https://developer.android.com/reference/android/graphics/Point.html) | [getCornerPoints](https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.TextBlock#getCornerPoints())() Gets the four corner points in clockwise direction starting with top-left. |
| synchronized [List](https://developer.android.com/reference/java/util/List.html)\<[Text.Line](https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.Line)\> | [getLines](https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.TextBlock#getLines())() Gets an unmodifiable list of `https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.Line`s that make up this text block. |
| [String](https://developer.android.com/reference/java/lang/String.html) | [getRecognizedLanguage](https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.TextBlock#getRecognizedLanguage())() Gets prevailing language in the text, if any. |
| [String](https://developer.android.com/reference/java/lang/String.html) | [getText](https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.TextBlock#getText())() Gets the recognized text in the `https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.TextBlock`. |

### Inherited Method Summary

From class java.lang.Object

|---|---|
| [Object](https://developer.android.com/reference/java/lang/Object.html) | clone() |
| boolean | equals([Object](https://developer.android.com/reference/java/lang/Object.html) arg0) |
| void | finalize() |
| final [Class](https://developer.android.com/reference/java/lang/Class.html)\<?\> | getClass() |
| int | hashCode() |
| final void | notify() |
| final void | notifyAll() |
| [String](https://developer.android.com/reference/java/lang/String.html) | toString() |
| final void | wait(long arg0, int arg1) |
| final void | wait(long arg0) |
| final void | wait() |

## Public Methods

#### public [Rect](https://developer.android.com/reference/android/graphics/Rect.html) **getBoundingBox** ()

Returns the axis-aligned bounding rectangle of the detected text. If nothing found,
it returns `null`.

#### public [Point\[\]](https://developer.android.com/reference/android/graphics/Point.html)
**getCornerPoints** ()

Gets the four corner points in clockwise direction starting with top-left. Due to
the possible perspective distortions, this is not necessarily a rectangle. Parts of the
region could be outside of the image. If nothing found, it returns
`null`.

#### public synchronized [List](https://developer.android.com/reference/java/util/List.html)\<[Text.Line](https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.Line)\>
**getLines** ()

Gets an unmodifiable list of `https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.Line`s
that make up this text block.

Returns an empty list if nothing is found.

#### public [String](https://developer.android.com/reference/java/lang/String.html) **getRecognizedLanguage** ()

Gets prevailing language in the text, if any. The format is in BCP47 (e.g. "en" or
"sr-Latn-BA") or "und" if the language could not be determined.

#### public [String](https://developer.android.com/reference/java/lang/String.html) **getText** ()

Gets the recognized text in the `https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.TextBlock`.
It concatenates text strings from underlying `https://developers.google.com/android/reference/com/google/mlkit/vision/text/Text.Line`s
separated by `'\n'`.

The recognized text is in reading order for the language. For Latin, this is top to
bottom within a TextBlock, and left-to-right within a Line.

Returns an empty string if nothing is found.