Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6014871
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:45:18+00:00 2026-05-23T02:45:18+00:00

I have a Gingerbread 2.3.4 powered Nexus S and I recently got some writable

  • 0

I have a Gingerbread 2.3.4 powered Nexus S and I recently got some writable NFC tags. So far I can read them as blank tags, but I couldn’t find a way to write data to them.
All my research has lead me to this article: Writing tags with Nexus S from January (before 2.3.4 release).

How do you write NFC tags inside your application, using your Nexus S? Any pointers?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:45:19+00:00Added an answer on May 23, 2026 at 2:45 am

    I found the Android NFC API text and dev guide a bit tricky to follow so a bit of example code might help here. This is actually a port of MIDP code I’ve been using in Nokia 6212 devices, so I probably haven’t yet figured out everything about Android NFC API correctly, but at least this has worked for me.

    First we create an NDEF record:

    private NdefRecord createRecord() throws UnsupportedEncodingException {
        String text       = "Hello, World!";
        String lang       = "en";
        byte[] textBytes  = text.getBytes();
        byte[] langBytes  = lang.getBytes("US-ASCII");
        int    langLength = langBytes.length;
        int    textLength = textBytes.length;
        byte[] payload    = new byte[1 + langLength + textLength];
    
        // set status byte (see NDEF spec for actual bits)
        payload[0] = (byte) langLength;
    
        // copy langbytes and textbytes into payload
        System.arraycopy(langBytes, 0, payload, 1,              langLength);
        System.arraycopy(textBytes, 0, payload, 1 + langLength, textLength);
    
        NdefRecord record = new NdefRecord(NdefRecord.TNF_WELL_KNOWN, 
                                           NdefRecord.RTD_TEXT, 
                                           new byte[0], 
                                           payload);
    
        return record;
    }
    

    Then we write the record as an NDEF message:

    private void write(Tag tag) throws IOException, FormatException {
        NdefRecord[] records = { createRecord() };
        NdefMessage  message = new NdefMessage(records);
    
        // Get an instance of Ndef for the tag.
        Ndef ndef = Ndef.get(tag);
    
        // Enable I/O
        ndef.connect();
    
        // Write the message
        ndef.writeNdefMessage(message);
    
        // Close the connection
        ndef.close();
    }
    

    To write to a tag, you obviously need the Tag object, which you can get from the Intent.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

No related questions found

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.