Share via


NdefRecord.CreateMime(String, Byte[]) Method

Definition

Create a new NDEF Record containing MIME data.

[Android.Runtime.Register("createMime", "(Ljava/lang/String;[B)Landroid/nfc/NdefRecord;", "")]
public static Android.Nfc.NdefRecord? CreateMime (string? mimeType, byte[]? mimeData);
[<Android.Runtime.Register("createMime", "(Ljava/lang/String;[B)Landroid/nfc/NdefRecord;", "")>]
static member CreateMime : string * byte[] -> Android.Nfc.NdefRecord

Parameters

mimeType
String

a valid MIME type

mimeData
Byte[]

MIME data as bytes

Returns

an NDEF Record containing the MIME-typed data

Attributes

Remarks

Create a new NDEF Record containing MIME data.

Use this method to encode MIME-typed data into an NDEF Record, such as "text/plain", or "image/jpeg".

The mimeType parameter will be normalized with Intent#normalizeMimeType to follow Android best practices for intent filtering, for example to force lower-case. However the unchecked exception IllegalArgumentException may be thrown if the mimeType parameter has serious problems, for example if it is empty, so always catch this exception if you are passing user-generated data into this method.

For efficiency, This method might not make an internal copy of the mimeData byte array, so take care not to modify the mimeData byte array while still using the returned NdefRecord.

Java documentation for android.nfc.NdefRecord.createMime(java.lang.String, byte[]).

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