SharingMenu

Bottom sheet menu displaying list of targets for sharing a document. The menu will automatically resolve share targets (i.e. apps installed on the current device) by querying the Android package manager. You can configure the menu to only show specific targets based on a ShareAction or filter Intent.

There are two ways to configure the menu:

  • Calling setShareAction will tell the menu to display all apps that can handle the given share action. Valid actions are ShareAction.SEND and ShareAction.VIEW.

  • Calling setShareIntents will make the menu display all apps that handle the provided intents. Use this if you only want to share with a small subset of apps (for example email clients).

Parameters

activity

The parent activity of the sharing menu. The menu will attach to this activity.

listener

SharingMenuListener for listening to user events on the menu.

Inheritors

Constructors

Link copied to clipboard
constructor(activity: FragmentActivity, listener: SharingMenu.SharingMenuListener?)

Types

Link copied to clipboard
fun interface SharingMenuListener

Listener for being notified of UI events on a SharingMenu.

Functions

Link copied to clipboard
open override fun dismiss()

Dismiss action menu if shown.

Link copied to clipboard

Returns a previously set ShareAction or null if no share action was set.

Link copied to clipboard
open override fun onDetach()

Called when menu is being detached from activity. This means that activity is in the background or is getting destroyed.

Link copied to clipboard
fun setShareAction(shareAction: ShareAction?)

Sets ShareAction that defines the share targets to display.

Link copied to clipboard
fun setSharedFileName(fileName: String?)

Sets file name (with extension) of the shared file. This will be used to query share targets that will be displayed.

Link copied to clipboard

Replace share menu items with items representing activities that are targets of given intents.

Link copied to clipboard
open override fun show(): Boolean

Shows action menu.