【发布时间】:2016-04-04 22:12:45
【问题描述】:
我目前正在尝试将几个字节写入特定块。我的读取命令工作正常,我可以使用以下代码读取标签的任何块:
command = new byte[]{
(byte) 0x02, // Flags
(byte) 0x23, // Command: Read multiple blocks
(byte) 0x09, // First block (offset)
(byte) 0x03 // Number of blocks // MAX READ SIZE: 32 blocks:1F
};
byte[] data = nfcvTag.transceive(command);
当我尝试使用下面的代码编写时,我的应用程序崩溃了。
Write = new byte[]{
(byte) 0x02, // Flags
(byte) 0x21, // Command: Write 1 blocks
(byte) 0x5A, // First block (offset)
(byte) 0x41 // Data
};
nfcvTag.transceive(Write);
我在 AsyncTask 中执行此操作并获得 java.lang.RuntimeException: Can't create handler inside thread that has not called Looper.prepare() 异常。
有什么建议吗?标签是 STMicroelectronics M24LR04E-R
【问题讨论】:
标签: java android nfc iso-15693