Code example for NdefRecord

0
            throw e;
        } 
    } 
 
    private NdefMessage getSmallNdef() {
        NdefRecord rec = new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_URI,
                new byte[] { 'A' }, "http://android.com".getBytes());
        return new NdefMessage(new NdefRecord[] { rec });
    } 
 
    private NdefMessage getLargeNdef() {
        int size = 500;
        StringBuffer string = new StringBuffer(size);
        for (int i = 0; i < size; i++) {
            string.append('A' + (i % 26));
        } 
        NdefRecord rec = new NdefRecord(NdefRecord.TNF_MIME_MEDIA, "text/plain".getBytes(),
                new byte[] { 'B' }, string.toString().getBytes());
        return new NdefMessage(new NdefRecord[] { rec });
    }