Skip to content

Instantly share code, notes, and snippets.

@ssaurel
Created November 9, 2017 13:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ssaurel/32ae0738edebfa3159a489ebaa708255 to your computer and use it in GitHub Desktop.
Save ssaurel/32ae0738edebfa3159a489ebaa708255 to your computer and use it in GitHub Desktop.
displayMsgs method for the NFC Reader tutorial
private void displayMsgs(NdefMessage[] msgs) {
if (msgs == null || msgs.length == 0)
return;
StringBuilder builder = new StringBuilder();
List<ParsedNdefRecord> records = NdefMessageParser.parse(msgs[0]);
final int size = records.size();
for (int i = 0; i < size; i++) {
ParsedNdefRecord record = records.get(i);
String str = record.str();
builder.append(str).append("\n");
}
text.setText(builder.toString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment