NdefFormatable ndefFormatable = NdefFormatable.get(tag);
if (ndefFormatable == null) {
throw new TagException("Not a NDEF formatable tag");
}
try {
if(!ndefFormatable.isConnected())
{
ndefFormatable.connect();
}
tagData.setUniqueId(tag.getId());
NdefMessage ndefMessage = buildNdefMessage(tagData);
ndefFormatable.format(ndefMessage);
}
catch (FormatException ex) {
throw new TagException(ex.getMessage());
}
finally {
ndefFormatable.close();
}
Run Code Online (Sandbox Code Playgroud)
当它进入try并执行connect()时,它总是抛出IOException
谁能帮我吗.
| 归档时间: |
|
| 查看次数: |
806 次 |
| 最近记录: |