get NFC Ndef Message Payload - Android Network

Android examples for Network:NFC Message

Description

get NFC Ndef Message Payload

Demo Code


//package com.java2s;

import android.nfc.NdefMessage;
import android.nfc.NdefRecord;

import java.util.ArrayList;

public class Main {
    public static ArrayList<String> getNdefMessagePayload(
            NdefMessage message) {//from   ww w. ja  v a  2  s. c  o m
        NdefRecord[] records = message.getRecords();

        ArrayList<String> payload = new ArrayList<String>();

        for (NdefRecord record : records)
            payload.add(new String(record.getPayload()));
        return payload;
    }
}

Related Tutorials