Code example for NdefMessage

Methods: toByteArray

     * write a message to a tag, handling various error conditions by returning 
     * false. If context != null, it makes Toast with the result 
    public static boolean writeTag(Context context, NdefMessage message, Tag tag)
        int size = message.toByteArray().length;
            Ndef ndef = Ndef.get(tag);
            if (ndef != null)
                if (!ndef.isWritable())
                    toast(context, "Tag is read-only.");
                    return false; 
                if (ndef.getMaxSize() < size)
Experience pair programming with AI  Get Codota for Java