Stay organized with collections
Save and categorize content based on your preferences.
OnShareTargetSelectedListener
interface OnShareTargetSelectedListener
Listener for the event of selecting a share target.
Summary
Public methods |
abstract Boolean |
Called when a share target has been selected.
|
Public methods
onShareTargetSelected
abstract fun onShareTargetSelected(
source: ShareActionProvider!,
intent: Intent!
): Boolean
Called when a share target has been selected. The client can decide whether to perform some action before the sharing is actually performed.
Note: Modifying the intent is not permitted and any changes to the latter will be ignored.
Note: You should not handle the intent here. This callback aims to notify the client that a sharing is being performed, so the client can update the UI if necessary.
Parameters |
source |
ShareActionProvider!: The source of the notification. |
intent |
Intent!: The intent for launching the chosen share target. |
Return |
Boolean |
The return result is ignored. Always return false for consistency. |
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,["# ShareActionProvider.OnShareTargetSelectedListener\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnShareTargetSelectedListener\n=============================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/widget/ShareActionProvider.OnShareTargetSelectedListener \"View this page in Java\") \n\n```\ninterface OnShareTargetSelectedListener\n```\n\n|-----------------------------------------------------------------------|\n| [android.widget.ShareActionProvider.OnShareTargetSelectedListener](#) |\n\nListener for the event of selecting a share target.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onShareTargetSelected](#onShareTargetSelected(android.widget.ShareActionProvider,%20android.content.Intent))`(`source:` `[ShareActionProvider](/reference/kotlin/android/widget/ShareActionProvider)!`, `intent:` `[Intent](../content/Intent.html#)!`)` Called when a share target has been selected. |\n\nPublic methods\n--------------\n\n### onShareTargetSelected\n\nAdded in [API level 14](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onShareTargetSelected(\n source: ShareActionProvider!, \n intent: Intent!\n): Boolean\n```\n\nCalled when a share target has been selected. The client can decide whether to perform some action before the sharing is actually performed.\n\n**Note:** Modifying the intent is not permitted and any changes to the latter will be ignored.\n\n**Note:** You should **not** handle the intent here. This callback aims to notify the client that a sharing is being performed, so the client can update the UI if necessary.\n\n| Parameters ||\n|----------|---------------------------------------------------------------------------------------------------------------|\n| `source` | [ShareActionProvider](/reference/kotlin/android/widget/ShareActionProvider)!: The source of the notification. |\n| `intent` | [Intent](../content/Intent.html#)!: The intent for launching the chosen share target. |\n\n| Return ||\n|------------------------------------------------------------------------------------|--------------------------------------------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | The return result is ignored. Always return false for consistency. |"]]