Stay organized with collections
Save and categorize content based on your preferences.
WriteResultCallback
abstract class WriteResultCallback
Base class for implementing a callback for the result of android.print.PrintDocumentAdapter#onWrite(android.print.PageRange[],android.os.ParcelFileDescriptor,android.os.CancellationSignal,android.print.PrintDocumentAdapter.WriteResultCallback)
.
Summary
Public methods |
open Unit |
Notifies that write was cancelled as a result of a cancellation request.
|
open Unit |
Notifies that an error occurred while writing the data.
|
open Unit |
Notifies that all the data was written.
|
Public methods
onWriteCancelled
open fun onWriteCancelled(): Unit
Notifies that write was cancelled as a result of a cancellation request.
onWriteFailed
open fun onWriteFailed(error: CharSequence!): Unit
Notifies that an error occurred while writing the data.
Parameters |
error |
CharSequence!: The localized error message. shown to the user. May be null if error is unknown. |
onWriteFinished
open fun onWriteFinished(pages: Array<PageRange!>!): Unit
Notifies that all the data was written.
Parameters |
pages |
Array<PageRange!>!: The pages that were written. Cannot be null or empty. Returning PageRange.ALL_PAGES indicates that all pages that were requested as the pages parameter in onWrite were written. |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# PrintDocumentAdapter.WriteResultCallback\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nWriteResultCallback\n===================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/print/PrintDocumentAdapter.WriteResultCallback \"View this page in Java\") \n\n```\nabstract class WriteResultCallback\n```\n\n|---|-------------------------------------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.print.PrintDocumentAdapter.WriteResultCallback](#) |\n\nBase class for implementing a callback for the result of [android.print.PrintDocumentAdapter#onWrite(android.print.PageRange[],android.os.ParcelFileDescriptor,android.os.CancellationSignal,android.print.PrintDocumentAdapter.WriteResultCallback)](/reference/kotlin/android/print/PrintDocumentAdapter#onWrite(kotlin.Array,%20android.os.ParcelFileDescriptor,%20android.os.CancellationSignal,%20android.print.PrintDocumentAdapter.WriteResultCallback)).\n\nSummary\n-------\n\n| Public methods ||\n|-----------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onWriteCancelled](#onWriteCancelled())`()` Notifies that write was cancelled as a result of a cancellation request. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onWriteFailed](#onWriteFailed(kotlin.CharSequence))`(`error:` `[CharSequence](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-char-sequence/index.html)!`)` Notifies that an error occurred while writing the data. |\n| open [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onWriteFinished](#onWriteFinished(kotlin.Array))`(`pages:` `[Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\u003c[PageRange](/reference/kotlin/android/print/PageRange)!\u003e!`)` Notifies that all the data was written. |\n\nPublic methods\n--------------\n\n### onWriteCancelled\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onWriteCancelled(): Unit\n```\n\nNotifies that write was cancelled as a result of a cancellation request. \n\n### onWriteFailed\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onWriteFailed(error: CharSequence!): Unit\n```\n\nNotifies that an error occurred while writing the data.\n\n| Parameters ||\n|---------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `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. |\n\n### onWriteFinished\n\nAdded in [API level 19](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nopen fun onWriteFinished(pages: Array\u003cPageRange!\u003e!): Unit\n```\n\nNotifies that all the data was written.\n\n| Parameters ||\n|---------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `pages` | [Array](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-array/index.html)\\\u003c[PageRange](/reference/kotlin/android/print/PageRange)!\\\u003e!: The pages that were written. Cannot be `null` or empty. Returning [PageRange.ALL_PAGES](/reference/kotlin/android/print/PageRange#ALL_PAGES:android.print.PageRange) indicates that all pages that were requested as the `pages` parameter in [onWrite](/reference/kotlin/android/print/PrintDocumentAdapter#onWrite(kotlin.Array,%20android.os.ParcelFileDescriptor,%20android.os.CancellationSignal,%20android.print.PrintDocumentAdapter.WriteResultCallback)) were written. |"]]