Code example for NdefMessage

Methods: getRecords

0
	void processIntent(Intent intent) {
		Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES);
		// in this context, only one message was sent over beam 
		NdefMessage msg = (NdefMessage) rawMsgs[0];
		// record 0 contains the MIME type, record 1 is the AAR, if present 
		String payload = new String(msg.getRecords()[0].getPayload());
		Toast.makeText(getApplicationContext(), "Message received over beam: " + payload, Toast.LENGTH_LONG).show();
	} 
 
} 
Stop searching for code, let great code find you!  Add Codota to your java IDE