List of usage examples for android.nfc NdefRecord toString
@Override
public String toString()
From source file:Main.java
static JSONObject recordToJSON(NdefRecord record) { JSONObject json = new JSONObject(); try {//from ww w. j av a 2s . co m json.put("tnf", record.getTnf()); json.put("type", byteArrayToJSON(record.getType())); json.put("id", byteArrayToJSON(record.getId())); json.put("payload", byteArrayToJSON(record.getPayload())); } catch (JSONException e) { //Not sure why this would happen, documentation is unclear. Log.e(TAG, "Failed to convert ndef record into json: " + record.toString(), e); } return json; }
From source file:io.v.example.vbeam.vbeamexample.MainActivity.java
@Override protected void onResume() { super.onResume(); Intent intent = getIntent();//from w w w . j a v a2s. c om if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(intent.getAction())) { Parcelable[] rawMsgs = intent.getParcelableArrayExtra(NfcAdapter.EXTRA_NDEF_MESSAGES); if (rawMsgs != null) { for (int i = 0; i < rawMsgs.length; i++) { for (NdefRecord r : ((NdefMessage) rawMsgs[i]).getRecords()) { System.out.println("record " + r.toString() + "(" + r.toUri() + ")"); } } } } }