NFC interface adaptation, reading and writing tags (Note and Galaxy series)

NFC interface adaptation, reading and writing tags (Note and Galaxy series)

Source code introduction

For NFC models, you can read and write tags.
Source code running screenshot

y

Source code snippet

  1. /Write content
  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 adapter, all NFC operations are performed from this adapter  
  12. nfcAdapter = NfcAdapter.getDefaultAdapter( this );
  13. if (!ifNFCUse()){
  14. return ;
  15. }
  16. //The Intent to be called, used to repeat the jump to be executed after being triggered by the Intent  
  17. pendingIntent = PendingIntent.getActivity( this , 0 , new Intent( this ,
  18. getClass()).addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0 );
  19. //Set the tag action to be filtered. Only ACTION_NDEF_DISCOVERED type is accepted here.  
  20. ndef = new IntentFilter(NfcAdapter.ACTION_NDEF_DISCOVERED);
  21. ndef.addCategory( "*/*" );
  22. mFilters = new IntentFilter[] { ndef }; // Filter  
  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() } }; // Tag types allowed to be scanned  
  27.          

Source code link: http://download..com/data/1978596

<<:  BlackBerry CEO: It's unfair that Apple doesn't develop apps for us

>>:  Nine-grid password lock entry program

Recommend

5000 words to explain Heytea's private domain operation method

A few days ago, when I was browsing the news, I f...

Chronic stress may be affecting your brain without you even realizing it

Leviathan Press: In fact, compared with acute str...

How to plan an event? 6 big steps!

The concept of "organizing an event" ma...

Samsung faces a lame situation: mobile phone addiction drags down performance

Lee Kun-hee, the helmsman of Samsung Group, is st...

The underlying logic of advertising

Today, let’s analyze the underlying logic of adve...

Pig: Lazy and gluttonous? God knows I have a high IQ.

I am Dong Dong Meow Talking animals are so fun! T...

Are the long, thin worms found in Sichuan dragon worms?

Recently, some netizens took photos of long white...

How to create a hit event?

Last week, I carried out the second content colle...

WeChat Reading Product Analysis Report

This article would like to take WeChat Reading as...