Code example for NdefRecord

0
        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);
 
        return new NdefRecord(NdefRecord.TNF_WELL_KNOWN, NdefRecord.RTD_TEXT, new byte[0], data);
    } 
 
    @Override 
    protected void onResume() { 
        super.onResume(); 
        if (mAdapter != null) {
            if (!mAdapter.isEnabled()) {
                showMessage(R.string.error, R.string.nfc_disabled); 
            } 
            mAdapter.enableForegroundDispatch(this, mPendingIntent, null, null);
            mAdapter.enableForegroundNdefPush(this, mNdefPushMessage);
        } 
    } 
 
Experience pair programming with AI  Get Codota for Java