Reading a text-formatted record
In this recipe, we will see how to handle the raw payload that we get from NdefRecord
and String
.
Getting ready
It will be assumed that Eclipse is the development IDE and you are familiarized creating the text-formatted NdefRecords
. Refer to the Writing a text-formatted record recipe in Chapter 3, Writing Tag Content.
How to do it…
This code complements the recipe where we learn how to write a string into a tag. Refer to the Writing a text-formatted record recipe in Chapter 3, Writing Tag Content.
Open Eclipse and create a new Android application project named
NfcBookCh5Example3
with package namenfcbook.ch5.example3
.Make sure the
AndroidManifest.xml
file is correctly configured. Refer to the Requesting NFC permissions recipe in Chapter 1, Getting Started with NFC.Import the
NfcHelper
class into the project and enable the foreground dispatch system.Add the following class member and instantiate it in the
onCreate
method:private NfcHelper nfcHelper; protected...