Code example for NdefMessage

Methods: getRecords

0
        } 
        return data;
    } 
 
    private byte[] getTagRawData(final NdefMessage msg) {
        if(msg == null || msg.getRecords().length < 1) return null;
        // we are only grabbing the first item 
        return msg.getRecords()[0].getPayload();
    } 
 
    /* 
     * the First Byte of the payload contains the "Status Byte Encodings" field, per the NFC Forum "Text Record Type Definition" section 3.2.1. 
     * 
     * Bit_7 is the Text Encoding Field. 
     * * if Bit_7 == 0 the the text is encoded in UTF-8 else if Bit_7 == 1 then the text is encoded in UTF16 
     * Bit_6 is currently always 0 (reserved for future use) 
     * Bits 5 to 0 are the length of the IANA language code. 
     */ 
    private String getText(final byte[] payload) {
        if(payload == null) return null;
        try {