Code example for NdefMessage

0
    } 
 
    private NdefMessage getSmallNdef() {
        NdefRecord rec = new NdefRecord(NdefRecord.TNF_ABSOLUTE_URI, NdefRecord.RTD_URI,
                new byte[0], "http://android.com".getBytes());
        return new NdefMessage(new NdefRecord[] { rec });
    } 
 
    private NdefMessage getLargeNdef() {
        int size = 3000;
        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[0], string.toString().getBytes());
        return new NdefMessage(new NdefRecord[] { rec });
    } 
}