# PrintDocumentAdapter.LayoutResultCallback

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

# LayoutResultCallback

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/android/print/PrintDocumentAdapter.LayoutResultCallback "View this page in Java")  

```
abstract class LayoutResultCallback
```

|---|--------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html)                                                                                     ||
| ↳ | [android.print.PrintDocumentAdapter.LayoutResultCallback](https://developer.android.com/reference/kotlin/android/print/PrintDocumentAdapter.LayoutResultCallback#) |

Base class for implementing a callback for the result of[android.print.PrintDocumentAdapter#onLayout(android.print.PrintAttributes,android.print.PrintAttributes,android.os.CancellationSignal,android.print.PrintDocumentAdapter.LayoutResultCallback,android.os.Bundle)](https://developer.android.com/reference/kotlin/android/print/PrintDocumentAdapter#onLayout(android.print.PrintAttributes,%20android.print.PrintAttributes,%20android.os.CancellationSignal,%20android.print.PrintDocumentAdapter.LayoutResultCallback,%20android.os.Bundle)).

## Summary

|                                                                                                                                                                                                                                                                             Public methods                                                                                                                                                                                                                                                                             ||
|----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onLayoutCancelled](https://developer.android.com/reference/kotlin/android/print/PrintDocumentAdapter.LayoutResultCallback#onLayoutCancelled())`()` Notifies that layout was cancelled as a result of a cancellation request.                                                                                                                                                                                                                                                        |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onLayoutFailed](https://developer.android.com/reference/kotlin/android/print/PrintDocumentAdapter.LayoutResultCallback#onLayoutFailed(kotlin.CharSequence))`(`error:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`)` Notifies that an error occurred while laying out the document.                                                                                                                                             |
| open[Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onLayoutFinished](https://developer.android.com/reference/kotlin/android/print/PrintDocumentAdapter.LayoutResultCallback#onLayoutFinished(android.print.PrintDocumentInfo,%20kotlin.Boolean))`(`info:` `[PrintDocumentInfo](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo)!`, `changed:` `[Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html)`)` Notifies that the layout finished and whether the content changed. |

## Public methods

### onLayoutCancelled

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

```
open fun onLayoutCancelled(): Unit
```

Notifies that layout was cancelled as a result of a cancellation request.  

### onLayoutFailed

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

```
open fun onLayoutFailed(error: CharSequence!): Unit
```

Notifies that an error occurred while laying out the document.

|                                                                                         Parameters                                                                                          ||
|---------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `error` | [CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!:The**localized** error message. shown to the user. May be`null`if error is unknown. |

### onLayoutFinished

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

```
open fun onLayoutFinished(
    info: PrintDocumentInfo!, 
    changed: Boolean
): Unit
```

Notifies that the layout finished and whether the content changed.

|                                                                                Parameters                                                                                ||
|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `info`    | [PrintDocumentInfo](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo)!:An info object describing the document. Cannot be`null`. |
| `changed` | [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html):Whether the layout changed.                                                |

**See Also**

- [android.print.PrintDocumentInfo](https://developer.android.com/reference/kotlin/android/print/PrintDocumentInfo)