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

Here are some tips on how to speak in live broadcast rooms. Use them!

Why is it that no one wants to buy the benefits w...

360 brings in the Coolpad master: How much of a role can he play?

Qihoo 360 invested 400 million US dollars to form...

Come and see these high-tech trucks that are no longer just big

When it comes to technology in the automotive fie...

Camels are worthy of their title as the "kings of the desert"

In nature, even elephants weighing 5 tons will be...

Next single: Shuffle my life? | Digital Literacy

Audit expert: Jing Yuan, Intermediate Accountant ...

What exactly made snail noodles smell bad?

Mixed Knowledge Specially designed to cure confus...

Why can’t we retain new users? Here are 4 best solutions

Why is it that even though we have been attractin...

How to increase product user growth? Share the 8-step plan!

The author uses a real case to explain how to bui...

2014 Mobile Internet Data Report (Full Version)

Mobile Internet information TalkingData released ...

Start a course (completed) Big Data Analysis Full Stack Engineer 016

Start a course (completed) Big Data Analysis Full...

Is WeChat phone book really keeping operators awake?

WeChat Phonebook is a smart communication softwar...