public final class

NdefMessage

extends Object
implements Parcelable
java.lang.Object
   ↳ android.nfc.NdefMessage

Class Overview

Represents an NDEF (NFC Data Exchange Format) data message that contains one or more NdefRecords.

An NDEF message includes "records" that can contain different sets of data, such as MIME-type media, a URI, or one of the supported RTD types (see NdefRecord). An NDEF message always contains zero or more NDEF records.

This is an immutable data class.

Summary

[Expand]
Inherited Constants
From interface android.os.Parcelable
Fields
public static final Creator<NdefMessage> CREATOR
Public Constructors
NdefMessage(byte[] data)
Create an NDEF message from raw bytes.
NdefMessage(NdefRecord[] records)
Create an NDEF message from NDEF records.
Public Methods
int describeContents()
NdefRecord[] getRecords()
Get the NDEF records inside this NDEF message.
byte[] toByteArray()
Returns a byte array representation of this entire NDEF message.
void writeToParcel(Parcel dest, int flags)
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.os.Parcelable

Fields

public static final Creator<NdefMessage> CREATOR

Also: Android

Public Constructors

public NdefMessage (byte[] data)

Also: Android

Create an NDEF message from raw bytes.

Validation is performed to make sure the Record format headers are valid, and the ID + TYPE + PAYLOAD fields are of the correct size.

public NdefMessage (NdefRecord[] records)

Also: Android

Create an NDEF message from NDEF records.

Public Methods

public int describeContents ()

Also: Android

public NdefRecord[] getRecords ()

Also: Android

Get the NDEF records inside this NDEF message.

Returns
  • array of zero or more NDEF records.

public byte[] toByteArray ()

Also: Android

Returns a byte array representation of this entire NDEF message.

public void writeToParcel (Parcel dest, int flags)

Also: Android