Partager via


View.GetReceiveContentMimeTypes Method

Definition

Returns the MIME types accepted by #performReceiveContent for this view, as configured via #setOnReceiveContentListener.

[Android.Runtime.Register("getReceiveContentMimeTypes", "()[Ljava/lang/String;", "GetGetReceiveContentMimeTypesHandler", ApiSince=31)]
public virtual string[]? GetReceiveContentMimeTypes ();
[<Android.Runtime.Register("getReceiveContentMimeTypes", "()[Ljava/lang/String;", "GetGetReceiveContentMimeTypesHandler", ApiSince=31)>]
abstract member GetReceiveContentMimeTypes : unit -> string[]
override this.GetReceiveContentMimeTypes : unit -> string[]

Returns

String[]

The MIME types accepted by #performReceiveContent for this view (may include patterns such as "image/*").

Attributes

Remarks

Returns the MIME types accepted by #performReceiveContent for this view, as configured via #setOnReceiveContentListener. By default returns null.

Different features (e.g. pasting from the clipboard, inserting stickers from the soft keyboard, etc) may optionally use this metadata to conditionally alter their behavior. For example, a soft keyboard may choose to hide its UI for inserting GIFs for a particular input field if the MIME types returned here for that field don't include "image/gif" or "image/*".

Note: Comparisons of MIME types should be performed using utilities such as ClipDescription#compareMimeTypes rather than simple string equality, in order to correctly handle patterns such as "text/*", "image/*", etc. Note that MIME type matching in the Android framework is case-sensitive, unlike formal RFC MIME types. As a result, you should always write your MIME types with lowercase letters, or use android.content.Intent#normalizeMimeType to ensure that it is converted to lowercase.

Java documentation for android.view.View.getReceiveContentMimeTypes().

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to