本文整理匯總了Java中android.nfc.NdefRecord.TNF_UNCHANGED屬性的典型用法代碼示例。如果您正苦於以下問題:Java NdefRecord.TNF_UNCHANGED屬性的具體用法?Java NdefRecord.TNF_UNCHANGED怎麽用?Java NdefRecord.TNF_UNCHANGED使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在類android.nfc.NdefRecord
的用法示例。
在下文中一共展示了NdefRecord.TNF_UNCHANGED屬性的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: parseTnf
private static String parseTnf(Context ctx, NdefRecord record) {
short tnf = record.getTnf();
switch(tnf) {
case NdefRecord.TNF_ABSOLUTE_URI:
return ctx.getString(R.string.tnf_abs_uri);
case NdefRecord.TNF_EMPTY:
return ctx.getString(R.string.tnf_empty);
case NdefRecord.TNF_EXTERNAL_TYPE:
return ctx.getString(R.string.tnf_external);
case NdefRecord.TNF_MIME_MEDIA:
return ctx.getString(R.string.tnf_mime_media);
case NdefRecord.TNF_UNCHANGED:
return ctx.getString(R.string.tnf_unchanged);
case NdefRecord.TNF_WELL_KNOWN:
return ctx.getString(R.string.tnf_well_known);
default:
return ctx.getString(R.string.tnf_unknown);
}
}
示例2: getRecordTypeCategory
private DataReply getRecordTypeCategory(int recordNumber) {
DataReply dataReply = new DataReply();
int type = UNKNOWN_TYPE;
if (currentTag != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD_MR1) {
Ndef ndef = Ndef.get(currentTag);
if (ndef != null) {
if (ndef.getCachedNdefMessage() != null)
if (ndef.getCachedNdefMessage().getRecords().length > recordNumber) {
NdefRecord record = ndef.getCachedNdefMessage().getRecords()[recordNumber];
int tnfType = record.getTnf();
switch (tnfType) {
case NdefRecord.TNF_EMPTY:
type = EMPTY_TYPE;
break;
case NdefRecord.TNF_WELL_KNOWN:
if (Arrays.equals(record.getType(), NdefRecord.RTD_URI)) {
type = URI_TYPE;
} else if (Arrays.equals(record.getType(), NdefRecord.RTD_TEXT)) {
type = TEXT_TYPE;
} else {
type = UNSUPPORTED_TYPE;
}
break;
case NdefRecord.TNF_ABSOLUTE_URI:
type = ABSOLUTE_URI_TYPE;
break;
case NdefRecord.TNF_EXTERNAL_TYPE:
type = EXTERNAL_TYPE;
break;
case NdefRecord.TNF_MIME_MEDIA:
type = MIME_MEDIA_TYPE;
break;
case NdefRecord.TNF_UNCHANGED:
type = UNCHANGED_TYPE;
break;
case NdefRecord.TNF_UNKNOWN:
type = UNKNOWN_TYPE;
break;
default:
type = UNKNOWN_TYPE;
break;
}
} else {
dataReply.setError(RECORD_NOT_FOUND);
return dataReply;
}
else {
dataReply.setError(RECORD_NOT_FOUND);
return dataReply;
}
} else {
dataReply.setError(TAG_READING_ERROR);
return dataReply;
}
try {
if (ndef != null) ndef.close();
} catch (IOException e) {
e.printStackTrace();
}
}
}
dataReply.setIntegerData(type);
return dataReply;
}