title: How to read and write to a NfcA card from Android
body: <p>I've made an app that is called when the intent android.nfc.action.TAG_DISCOVERED is sent, but then I want to get the info of the card in the onNewIntent method, but I don't know how to handle this kind of nfc cards. I tried with the following code:</p>
  
  <pre><code>    public void onNewIntent(Intent intent) {
          Tag tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG);
          //do something with tagFromIntent
          NfcA nfca = NfcA.get(tagFromIntent);
          try{
              nfca.connect();
              Short s = nfca.getSak();
              byte[] a = nfca.getAtqa();
              String atqa = new String(a, Charset.forName("US-ASCII"));
              tv.setText("SAK = "+s+"\nATQA = "+atqa);
              nfca.close();
          }
          catch(Exception e){
              Log.e(TAG, "Error when reading tag");
              tv.setText("Error");
          }
      }
  </code></pre>
  
  <p>tv is a TextView, but when this code is executed it never gets changed.</p>