Android 12 Developer Preview is here! Try it out, and give us your feedback!

OnReceiveContentViewBehavior

interface OnReceiveContentViewBehavior
androidx.core.view.OnReceiveContentViewBehavior

Interface for widgets to implement default behavior for receiving content. Content may be both text and non-text (plain/styled text, HTML, images, videos, audio files, etc).

Widgets should implement this interface to define the default behavior for receiving content. Apps wishing to provide custom behavior for receiving content should set a listener via ViewCompat#setOnReceiveContentListener. See ViewCompat#performReceiveContent for more info.

Summary

Public methods
abstract ContentInfoCompat?

Implements a view's default behavior for receiving content.

Public methods

onReceiveContent

@Nullable abstract fun onReceiveContent(@NonNull payload: ContentInfoCompat): ContentInfoCompat?

Implements a view's default behavior for receiving content.

Parameters
payload ContentInfoCompat: The content to insert and related metadata.
Return
ContentInfoCompat? The portion of the passed-in content that was not handled (may be all, some, or none of the passed-in content).