本文整理匯總了Java中android.nfc.NdefRecord.getId方法的典型用法代碼示例。如果您正苦於以下問題:Java NdefRecord.getId方法的具體用法?Java NdefRecord.getId怎麽用?Java NdefRecord.getId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.nfc.NdefRecord
的用法示例。
在下文中一共展示了NdefRecord.getId方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parse
import android.nfc.NdefRecord; //導入方法依賴的package包/類
public static UnsupportedRecord parse(NdefRecord ndefRecord) {
return new UnsupportedRecord(ndefRecord.getTnf(), ndefRecord.getType(), ndefRecord.getId(), ndefRecord.getPayload());
}
示例2: UnsupportedRecord
import android.nfc.NdefRecord; //導入方法依賴的package包/類
public UnsupportedRecord(NdefRecord record) {
this(record.getTnf(), record.getType(), record.getId(), record.getPayload());
}
示例3: parse
import android.nfc.NdefRecord; //導入方法依賴的package包/類
/**
* Parse a byte-based {@link NdefRecord} into a high-level {@link Record}.
*
* @param ndefRecord record to parse
* @return corresponding {@link Record} subclass - {@link UnsupportedRecord} is not known.
* @throws FormatException if known record type cannot be parsed
*/
public static Record parse(NdefRecord ndefRecord) throws FormatException {
short tnf = ndefRecord.getTnf();
Record record = null;
switch (tnf) {
case NdefRecord.TNF_EMPTY: {
record = EmptyRecord.parse(ndefRecord);
break;
}
case NdefRecord.TNF_WELL_KNOWN: {
record = parseWellKnown(ndefRecord);
break;
}
case NdefRecord.TNF_MIME_MEDIA: {
record = MimeRecord.parse(ndefRecord);
break;
}
case NdefRecord.TNF_ABSOLUTE_URI: {
record = AbsoluteUriRecord.parse(ndefRecord);
break;
}
case NdefRecord.TNF_EXTERNAL_TYPE: {
record = ExternalTypeRecord.parse(ndefRecord);
break;
}
case NdefRecord.TNF_UNKNOWN: {
record = UnknownRecord.parse(ndefRecord);
break;
}
/*
case NdefRecord.TNF_UNCHANGED: {
throw new IllegalArgumentException("Chunked records no supported"); // chunks are abstracted away by android so should never happen
}
*/
}
if(record == null) { // pass through
record = UnsupportedRecord.parse(ndefRecord);
}
if(ndefRecord.getId().length > 0) {
record.setId(ndefRecord.getId());
}
return record;
}