I mistook my original question as one of conversion, when it's one of a FormatException. I'm trying to write an NFC tag based upon an EditText input. Relevant code below:
EditText msgInput = (EditText) findViewById(R.id.editText1);
...
try {
String msg = msgInput.getText().toString();
byte[] bytes = msg.getBytes();
messagePayload = bytes;
}
...
NdefMessage message;
try {
message = new NdefMessage(messagePayload);
} catch (FormatException e) {
// ups, illegal ndef message payload
Log.e(TAG, "Format exception from illegal ndef message payload");
return;
}
And it's always throwing that FormatException. I'm not sure why. I'm just trying to write 'xyz' or 'stuff' or something like that. I ensure I'm getting the right bytes from Log statements between each.