I'm doing an experiment with NFC and I need to write to a MIFARE Classic tag, but its giving me an Exception because it needs 16 bytes. This would sound kind of noobish but I have tried everything and still it gives me the same exception:
Caused by: java.lang.IllegalArgumentException: must write 16-bytes
at android.nfc.tech.MifareClassic.writeBlock(MifareClassic.java:446)
at com.kaissersoft.cartracker.MainActivity$1$1.doInBackground(MainActivity.java:80)
at com.kaissersoft.cartracker.MainActivity$1$1.doInBackground(MainActivity.java:72)
at android.os.AsyncTask$2.call(AsyncTask.java:297)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
One of the pieces of code I used:
mifare.connect();
//DO STUFF
mifare.writeBlock(4, "CAR 100000000000".getBytes(Charset.forName("UTF-16LE")));