To program your MIDlet to communicate with contactless targets:
The following figure shows the typical flow of a MIDlet using the Contactless Communication API. The top row corresponds to step 1 above, while the bottom row corresponds to step 2.
Figure: Typical flow of a contactless communication MIDlet
The Contactless Communication API also provides a dedicated interface for detecting and reading data from NDEF targets. If you design your MIDlet to only read NDEF data from NFC devices or tags, use the dedicated interface, as it is simpler to implement than the generic approach described above.
The following figure shows the flow of a MIDlet using the dedicated interface for NDEF targets.
Figure: Detecting and reading data from NDEF targets
For more information about the Contactless Communication API classes and methods, see the specification and implementation notes.