Create new NFC Mime Record - Android Network

Android examples for Network:NFC Record

Description

Create new NFC Mime Record

Demo Code


//package com.java2s;

import java.nio.charset.Charset;

import android.nfc.NdefRecord;

public class Main {

    public static NdefRecord newMimeRecord(String mimeType, byte[] payload) {
        byte[] mimeBytes = mimeType.getBytes(Charset.forName("UTF-8"));
        NdefRecord mimeRecord = new NdefRecord(NdefRecord.TNF_MIME_MEDIA,
                mimeBytes, new byte[0], payload);
        return mimeRecord;
    }/* w  w w  . j  a v a  2 s  .  c  om*/
}

Related Tutorials