Java 为什么我只能显示NFC标签(nDEF)的前4页

Java 为什么我只能显示NFC标签(nDEF)的前4页,java,android,nfc,ndef,Java,Android,Nfc,Ndef,我正在尝试访问NFC标签上的信息。。我只能从标记内存的前4页检索数据 请参阅下面的屏幕截图,了解我试图从标记读取的数据 我目前在LogCat中得到的响应是重复的: I/来自标签的输出:1D045ACB I/来自标签的输出:31580000 来自标签的输入/输出:69A20000来自标签的输入/输出:E1106F00 I/来自标签的输出:1D045ACB I/来自标签的输出:31580000 来自标签的输入/输出:69A20000来自标签的输入/输出:E1106F00 I/来自标签的输出:1D0

我正在尝试访问NFC标签上的信息。。我只能从标记内存的前4页检索数据

请参阅下面的屏幕截图,了解我试图从标记读取的数据

我目前在LogCat中得到的响应是重复的:

I/来自标签的输出:1D045ACB I/来自标签的输出:31580000 来自标签的输入/输出:69A20000来自标签的输入/输出:E1106F00 I/来自标签的输出:1D045ACB I/来自标签的输出:31580000 来自标签的输入/输出:69A20000来自标签的输入/输出:E1106F00 I/来自标签的输出:1D045ACB I/来自标签的输出:31580000 来自标签的输入/输出:69A20000来自标签的输入/输出:E1106F00 I/来自标签的输出:1D045ACB I/来自标签的输出:31580000 来自标签的输入/输出:69A20000来自标签的输入/输出:E1106F00

public类MainActivity扩展了AppCompatActivity{
私有文本查看文本;
专用NfcAdapter mNfcAdapter;
私人意向过滤器[]多个过滤器;
私有字符串[][]mtechList;
下垂的下垂的;
静态最终字符串DATA=“DATA”;
私有ArrayList readTag;
@凌驾
RestoreInstanceState上的受保护无效(Bundle savedInstanceState){
super.onRestoreInstanceState(savedInstanceState);
}
@凌驾
SaveInstanceState上的公共无效(束超出状态){
super.onSaveInstanceState(超出状态);
}
@凌驾
创建时受保护的void(Bundle savedInstanceState){
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
readTag=newarraylist();
PendingEvent=PendingEvent.getActivity(this,0,new Intent(this,getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP | Intent.FLAG_ACTIVITY_CLEAR_TOP),0);
IntentFilter ndef=新的IntentFilter(NfcAdapter.ACTION\u TECH\u发现);
试一试{
ndef.addDataType(“*/*”);
}捕获(IntentFilter.MalformAdminetypeException){
}
mNfcAdapter=NfcAdapter.getDefaultAdapter(此);
mFilters=newintentfilter[]{ndef};
mtechList=新字符串[][]{
新字符串[]{Ndef.class.getName()}
};
Intent i=getIntent();
如果(i!=null){
if(i.getAction()==NfcAdapter.ACTION\u TECH\u发现){
阅读内容(一);
}
}
}
私人无效阅读内容(意图){
Tag Tag=intent.getParcelableExtra(NfcAdapter.EXTRA_Tag);
String[]techList=tag.getTechList();
Boolean containsNfcA=Arrays.toString(techList.contains)(NfcA.class.getName());
if(包含SNFCA){
ArrayList结果=readNfcATag(标签);
readTag.clear();
addAll(reformatByteStringArray(result));
}
for(字符串s:readTag){
Log.i(“来自标签的输出”,s);
}
}
//40:BD:32:95:22:D8
公共静态ArrayList reformatByteStringArray(ArrayList bytelist){
int tempIndex=0;
ArrayList FormattedList=新建ArrayList();
if(bytelist!=null){
字符串页=”;
对于(int index=0;index
您正在使用相同的
命令
,而不增加右焦点中的x值。所以你总是读同样的前四页。 请尝试以下操作:

if (nfcATag != null) {

            int x = 0;
            value = new ArrayList<>();

            while (x<MAXIMUN_SIZE_OF_NDEF_MESSAGE) {
      //chose better condition to break the while, but not in any way your actuall condition.
                byte[] command = new byte[]{0x30 , (byte) x};
                byte[] payload = nfcATag.transceive(command);



                int index = 0;
                for (byte b : payload) {
                    value.add(b);
                    index++;
                }
                x += 4;
                //TODO change this to check whether the first 8 elements in list are the same as equal to byte sequence
            }

        }
if(nfcATag!=null){
int x=0;
值=新的ArrayList();
while(x
if (nfcATag != null) {

            int x = 0;
            value = new ArrayList<>();

            while (x<MAXIMUN_SIZE_OF_NDEF_MESSAGE) {
      //chose better condition to break the while, but not in any way your actuall condition.
                byte[] command = new byte[]{0x30 , (byte) x};
                byte[] payload = nfcATag.transceive(command);



                int index = 0;
                for (byte b : payload) {
                    value.add(b);
                    index++;
                }
                x += 4;
                //TODO change this to check whether the first 8 elements in list are the same as equal to byte sequence
            }

        }