NFC NdefFormatable class connect () lanza IOException
Frecuentes
Visto 1,155 equipos
6
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();
}
When it goes into the try and execute connect() it always throws IOException
can any one help me out.
0 Respuestas
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas java android nfc or haz tu propia pregunta.
invalid operation for unregister MVA with VA(0x54f66000) size(466560) - Query
todo log please - Mario Stoilov
Is the exception thrown upon
connect()
orformat()
? Is your tag still in range when you exectue that code? In what thread (I.e. how do you create it?) do you execute that code? - Michael Rolandexception is on on connect() , i have separate thread for its execution... and its already in doInBackground(). - Query
You might want to try manual creation of a worker thread instead of using an AsyncTask then. See esta pregunta for a problem that sounds very similar. - Michael Roland