自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

NFC接口適配,讀寫標簽(Note與Galaxy系列)

移動開發(fā)
針對NFC機型,可以對標簽進行讀寫操作。

源碼簡介

針對NFC機型,可以對標簽進行讀寫操作。
源碼運行截圖

y

 

 

源碼片段

  1. /寫入內(nèi)容 
  2.         toWBtn=(Button)findViewById(R.id.toWBtn); 
  3.         toWBtn.setOnClickListener(new OnClickListener() { 
  4.             @Override 
  5.             public void onClick(View arg0) { 
  6.                 // TODO Auto-generated method stub 
  7.                 Intent intent=new Intent(MainActivity.this,Write2Nfc.class); 
  8.                 startActivity(intent); 
  9.             } 
  10.         }); 
  11.         //NFC適配器,所有的關(guān)于NFC的操作從該適配器進行 
  12.         nfcAdapter = NfcAdapter.getDefaultAdapter(this); 
  13.         if(!ifNFCUse()){ 
  14.             return
  15.         } 
  16.         //將被調(diào)用的Intent,用于重復被Intent觸發(fā)后將要執(zhí)行的跳轉(zhuǎn) 
  17.         pendingIntent = PendingIntent.getActivity(this0new Intent(this
  18.                 getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); 
  19.         //設(shè)定要過濾的標簽動作,這里只接收ACTION_NDEF_DISCOVERED類型 
  20.         ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED); 
  21.         ndef.addCategory("*/*"); 
  22.         mFilters = new IntentFilter[] { ndef };// 過濾器 
  23.         mTechLists = new String[][] { new String[] { NfcA.class.getName() }, 
  24.                 new String[] { NfcF.class.getName() }, 
  25.                 new String[] { NfcB.class.getName() }, 
  26.                 new String[] { NfcV.class.getName() } };// 允許掃描的標簽類型 
  27.          

 源碼鏈接:http://down.51cto.com/data/1978596

責任編輯:chenqingxiang 來源: 網(wǎng)絡整理
相關(guān)推薦

2017-01-03 07:25:15

科技新聞早報三星

2022-05-12 14:22:39

NFC標簽鴻蒙

2012-04-13 13:40:06

三星

2016-10-26 05:04:34

三星科技新聞早報

2022-06-10 14:45:34

燒錄NFC碼流鴻蒙

2012-05-04 14:17:31

評測

2012-04-04 11:41:31

三星

2013-01-23 14:42:26

Android開發(fā)NFC

2016-11-03 06:27:17

三星科技新聞早報

2012-03-22 21:15:43

Android

2012-05-01 16:38:40

三星

2015-07-13 16:56:40

IOS 9適配教程

2012-04-01 14:21:50

三星webOSGalaxy

2012-03-17 19:45:13

Android

2013-01-30 15:36:03

NFC移動支付藍牙

2021-02-26 20:55:56

JavaNIO隨機

2020-10-25 08:56:21

適配器模式

2018-09-13 12:28:11

iPhone蘋果開發(fā)者

2023-03-21 18:10:34

USB接口鴻蒙

2015-06-24 10:06:09

iOS 9適配后臺
點贊
收藏

51CTO技術(shù)棧公眾號