简体   繁体   中英

Ndef.getType() return the string as 'org.nfcforum.ndef.type2', but i want in this type 'NFC_FORUM_TYPE_2'

I want to get the Tag type... so i used the code like

Tag myTag = (Tag) nfcintent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
Ndef ndefTag = Ndef.get(myTag);
String NFCType =ndefTag.getType(); 

the result comes like NFCType= org.nfcforum.ndef.type2

but i want to show result as 'NFC_FORUM_TYPE_2.

Thanks in advance

The possible return values of Ndef.getType() are:

 "org.nfcforum.ndef.type1"
 "org.nfcforum.ndef.type2"
 "org.nfcforum.ndef.type3"
 "org.nfcforum.ndef.type4"
 "com.nxp.ndef.mifareclassic"
 "com.nxp.ndef.icodesli"

If you want anything else than this, you will have to define that yourself (eg using a HashMap ), based on these return values.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM