Code example for NdefRecord

    char status = (char) (utfBit + langBytes.length);
    byte[] data = new byte[1 + langBytes.length + textBytes.length];
    data[0] = (byte) status;
    System.arraycopy(langBytes, 0, data, 1, langBytes.length);
    System.arraycopy(textBytes, 0, data, 1 + langBytes.length, textBytes.length);
    NdefRecord record = new NdefRecord(NdefRecord.TNF_WELL_KNOWN,
        NdefRecord.RTD_TEXT, new byte[0], data);
    return record;
  public static void resolveNFCIntent(Intent intent, NearField nfc){
    String action = intent.getAction();
    //activity.setIntent(new Intent()); // Consume this intent.  Is this the right thing? 
    if (NfcAdapter.ACTION_NDEF_DISCOVERED.equals(action)) {
      // When a tag is discovered we send it to the service to be save. We 
      // include a PendingIntent for the service to call back onto. This 
      // will cause this activity to be restarted with onNewIntent(). At 
      // that time we read it from the database and view it. 
      // We'll keep this database code in here for now, but it's useless, because we 
      // can use AppInventor higher level operations to manipulate the tag data. 
Experience pair programming with AI  Get Codota for Java