当我标记NFC卡时。我直接进入主页面。但我想在同一页面使用片段。
@override
public void onResume() {
super.onResume();
Intent intent = getActivity().getIntent();
String action = intent.getAction();
if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(action)) {
Tag tag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
if (tag == null) {
nNfcNumber.setText("tag == null");
} else {
String tagInfo = "";
byte[] tagId = tag.getId();
for (int i = 0; i < tagId.length; i++) {
tagInfo += Integer.toHexString(tagId[i] & 0xFF) + "";
}
tagInfo += "";
nNfcNumber.setText(tagInfo);
nNFcnumber = nNfcNumber.getText().toString().trim();
Log.d("dfdgdfdf", " " + nNFcnumber);
}
} else {
}
}