Stay organized with collections
Save and categorize content based on your preferences.
DataShareWriteAdapter
public
interface
DataShareWriteAdapter
android.view.contentcapture.DataShareWriteAdapter
|
Adapter class used by apps to share data with the Content Capture service.
Summary
Public methods |
default
void
|
onError(int errorCode)
Method invoked when an error occurred, for example sessions has not been started or
terminated unsuccessfully.
|
abstract
void
|
onRejected()
Data share sessions has been rejected by the Content Capture service.
|
abstract
void
|
onWrite(ParcelFileDescriptor destination)
Method invoked when the data share session has been started and the app needs to start
writing into the file used for sharing.
|
Public methods
onError
public void onError (int errorCode)
Method invoked when an error occurred, for example sessions has not been started or
terminated unsuccessfully.
onRejected
public abstract void onRejected ()
Data share sessions has been rejected by the Content Capture service.
onWrite
public abstract void onWrite (ParcelFileDescriptor destination)
Method invoked when the data share session has been started and the app needs to start
writing into the file used for sharing.
App needs to handle explicitly cases when the file descriptor is closed and handle
gracefully if IOExceptions happen.
Parameters |
destination |
ParcelFileDescriptor : file descriptor used to write data into.
This value cannot be null . |
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.
[null,null,["Last updated 2025-02-10 UTC."],[],[],null,["# DataShareWriteAdapter\n\nAdded in [API level 30](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\nDataShareWriteAdapter\n=====================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/view/contentcapture/DataShareWriteAdapter \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\n\n\ninterface\nDataShareWriteAdapter\n`\n\n\n`\n\n\n`\n\n|---------------------------------------------------|\n| android.view.contentcapture.DataShareWriteAdapter |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nAdapter class used by apps to share data with the Content Capture service.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` default void` | ` `[onError](/reference/android/view/contentcapture/DataShareWriteAdapter#onError(int))`(int errorCode) ` Method invoked when an error occurred, for example sessions has not been started or terminated unsuccessfully. |\n| ` abstract void` | ` `[onRejected](/reference/android/view/contentcapture/DataShareWriteAdapter#onRejected())`() ` Data share sessions has been rejected by the Content Capture service. |\n| ` abstract void` | ` `[onWrite](/reference/android/view/contentcapture/DataShareWriteAdapter#onWrite(android.os.ParcelFileDescriptor))`(`[ParcelFileDescriptor](/reference/android/os/ParcelFileDescriptor)` destination) ` Method invoked when the data share session has been started and the app needs to start writing into the file used for sharing. |\n\nPublic methods\n--------------\n\n### onError\n\nAdded in [API level 30](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic void onError (int errorCode)\n```\n\nMethod invoked when an error occurred, for example sessions has not been started or\nterminated unsuccessfully.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|-------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| `errorCode` | `int`: the error code corresponding to an ERROR_\\* value. Value is [ContentCaptureManager.DATA_SHARE_ERROR_UNKNOWN](/reference/android/view/contentcapture/ContentCaptureManager#DATA_SHARE_ERROR_UNKNOWN), [ContentCaptureManager.DATA_SHARE_ERROR_CONCURRENT_REQUEST](/reference/android/view/contentcapture/ContentCaptureManager#DATA_SHARE_ERROR_CONCURRENT_REQUEST), or [ContentCaptureManager.DATA_SHARE_ERROR_TIMEOUT_INTERRUPTED](/reference/android/view/contentcapture/ContentCaptureManager#DATA_SHARE_ERROR_TIMEOUT_INTERRUPTED) \u003cbr /\u003e |\n\n### onRejected\n\nAdded in [API level 30](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onRejected ()\n```\n\nData share sessions has been rejected by the Content Capture service.\n\n\u003cbr /\u003e\n\n### onWrite\n\nAdded in [API level 30](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onWrite (ParcelFileDescriptor destination)\n```\n\nMethod invoked when the data share session has been started and the app needs to start\nwriting into the file used for sharing.\n\nApp needs to handle explicitly cases when the file descriptor is closed and handle\ngracefully if IOExceptions happen.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|---------------|------------------------------------------------------------------------------------------------------|\n| `destination` | `ParcelFileDescriptor`: file descriptor used to write data into. This value cannot be `null`. \u003cbr /\u003e |"]]