Code example for NdefRecord

Methods: getPayload, getType

0
                NdefMessage msg = (NdefMessage) rawMsgs[0];
                // Record 0 contains the MIME type, record 1 is the AAR, if present. 
                // In iosched, AARs are not present. 
                NdefRecord mimeRecord = msg.getRecords()[0];
                if (ScheduleContract.Sessions.CONTENT_ITEM_TYPE.equals( 
                        new String(mimeRecord.getType()))) {
                    // Re-set the activity's intent to one that represents session details. 
                    Intent sessionDetailIntent = new Intent(Intent.ACTION_VIEW,
                            Uri.parse(new String(mimeRecord.getPayload())));
                    activity.setIntent(sessionDetailIntent);
                } 
            } 
        } 
    } 
 
    @TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
    public static void setBeamCompleteCallback(Activity activity,
            NfcAdapter.OnNdefPushCompleteCallback callback) {
 
        if (UIUtils.hasICS()) { 
            NfcAdapter adapter = NfcAdapter.getDefaultAdapter(activity);