create NFC Mime Record - Android Network

Android examples for Network:NFC Record

Description

create NFC Mime Record

Demo Code


//package com.java2s;
import java.nio.charset.Charset;

import android.nfc.NdefRecord;

public class Main {
    public static NdefRecord createMimeRecord(String mimeType,
            byte[] payload) {
        byte[] mimeBytes = mimeType.getBytes(Charset.forName("US-ASCII"));
        NdefRecord mimeRecord = new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
                mimeBytes, new byte[0], payload);
        return mimeRecord;
    }/* ww w  .  j a va 2s .c o m*/
}

Related Tutorials