Android examples for Network:NFC Message
write NFC Ndef to NdefMessage
//package com.java2s; import android.nfc.NdefMessage; import android.nfc.tech.Ndef; import java.io.IOException; public class Main { private static void writeInNdef(NdefMessage message, Ndef ndef) throws Exception { ndef.connect();/*www .ja v a2s.com*/ if (!ndef.isWritable()) { throw new IOException("Tag is read-only."); } if (ndef.getMaxSize() < message.toByteArray().length) { throw new IOException("Tag capacity is " + ndef.getMaxSize() + " bytes, message is " + message.toByteArray().length + " bytes."); } ndef.writeNdefMessage(message); } }