NDefText
com.rvi.domain.NDefText · Record · SocialCard 1.0.3
A UTF-8 NDEF text record with a language tag.
When to use it
Section titled “When to use it”Supply a nonempty string and a language tag such as en or de-CH. Use this for labels or short notes that you want downstream applications to read as text.
Java example
Section titled “Java example”final NDefText label = new NDefText("Mein Portfolio", "de-CH");final NDefMessage message = new NDefMessageCreator().add(label).build();
System.out.println(new NDefDecoder().decode(message));Java imports
import com.rvi.application.NDefDecoder;import com.rvi.application.creator.NDefMessageCreator;import com.rvi.domain.NDefMessage;import com.rvi.domain.NDefText;An accented or non-ASCII character can take multiple bytes. Check the encoded message size before writing longer text.
How it works
Section titled “How it works”The constructor checks Unicode and validates the ASCII language tag with Locale.Builder. Its limit is 63 bytes because the NDEF text status byte reserves six bits for the language length. The payload contains this byte, the language and the UTF-8 text.
Related API
Section titled “Related API”NDefTextCreator · NDefMessageCreator · TlvEncoder · NDefValueException