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.

Manuel Allenspach
  • 12,467
  • 14
  • 54
  • 76
Query
  • 625
  • 1
  • 7
  • 22
  • invalid operation for unregister MVA with VA(0x54f66000) size(466560) – Query Jun 12 '14 at 11:09
  • 2
    the **whole** log please – Mario Stoilov Jun 12 '14 at 11:20
  • Is the exception thrown upon `connect()` or `format()`? 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 Roland Jun 12 '14 at 14:39
  • exception is on on connect() , i have separate thread for its execution... and its already in doInBackground(). – Query Jun 13 '14 at 04:52
  • You might want to try manual creation of a worker thread instead of using an AsyncTask then. See [this question](http://stackoverflow.com/q/23827996/2425802) for a problem that sounds very similar. – Michael Roland Jun 13 '14 at 06:07
  • i tried with worker thread but facing same issue.. – Query Jun 13 '14 at 07:22
  • Do you immediately connect to the tag after it has been scanned or do you do other things in between? Also I assume that you do **not** try to single-step debug this part of your code, right? – Michael Roland Jun 13 '14 at 16:04

0 Answers0