private void initNfc() { nfcAdapter = NfcAdapter.getDefaultAdapter(this); if (nfcAdapter == null) { BaseHelp.ShowDialog(this, "您的设备不支持NFC,是否退出!", 0); // return; } if (!nfcAdapter.isEnabled()) { BaseHelp.ShowDialog(this, "您的设备没有打开NFC功能!", 1); // return; } pendingIntent = PendingIntent.getActivity( this, 0, new Intent(this, getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); IntentFilter intentFilter = new IntentFilter(NfcAdapter.ACTION_TECH_DISCOVERED); intentFilter.addCategory("*//*"); intentFilters = new IntentFilter[] {intentFilter}; // 过滤器 techList = new String[][] { new String[] {MifareClassic.class.getName()}, new String[] {NfcA.class.getName()} }; // 允许扫描的标签类型 }
@Override public void onClick(View v) { // view_main.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION); switch (v.getId()) { case R.id.login_ok_bt: if (login_card) { BaseHelp.ShowDialog(this, "请刷卡登录!", 1); return; } Logining(); // new Thread(runnable).start(); break; } }