@Override public CharSequence getDisplayContents() { TextParsedResult result = (TextParsedResult) getResult(); StringBuilder contents = new StringBuilder(100); ParsedResult.maybeAppend(result.getText(), contents); contents.trimToSize(); return contents.toString(); }
public static TextParsedResult parse(Result result) { byte[] bytes = result.getRawBytes(); if (bytes == null) { return null; } NDEFRecord ndefRecord = NDEFRecord.readRecord(bytes, 0); if (ndefRecord == null || !ndefRecord.isMessageBegin() || !ndefRecord.isMessageEnd()) { return null; } if (!ndefRecord.getType().equals(NDEFRecord.TEXT_WELL_KNOWN_TYPE)) { return null; } String[] languageText = decodeTextPayload(ndefRecord.getPayload()); return new TextParsedResult(languageText[0], languageText[1]); }