List of usage examples for android.nfc Tag toString
@Override
public String toString()
From source file:org.openhab.habdroid.ui.OpenHABWriteTagActivity.java
@Override public void onNewIntent(Intent intent) { if (mSitemapPage == null) { return;/* w w w . j ava2 s . c o m*/ } Tag tagFromIntent = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); //do something with tagFromIntent Log.d(TAG, "NFC TAG = " + tagFromIntent.toString()); Log.d(TAG, "Writing page " + mSitemapPage + " to tag"); TextView writeTagMessage = findViewById(R.id.write_tag_message); try { URI sitemapURI = new URI(mSitemapPage); if (!sitemapURI.getPath().startsWith("/rest/sitemaps")) { throw new URISyntaxException(mSitemapPage, "Expected a sitemap URL"); } StringBuilder uriToWrite = new StringBuilder("openhab://sitemaps"); uriToWrite.append(sitemapURI.getPath().substring(14)); if (!TextUtils.isEmpty(mItem) && !TextUtils.isEmpty(mCommand)) { uriToWrite.append("?item=").append(mItem).append("&command=").append(mCommand); } writeTagMessage.setText(R.string.info_write_tag_progress); writeTag(tagFromIntent, uriToWrite.toString()); } catch (URISyntaxException e) { Log.e(TAG, e.getMessage()); writeTagMessage.setText(R.string.info_write_failed); } }
From source file:st.alr.homA.ActivityQuickpublishNfc.java
@Override protected void onNewIntent(Intent intent) { Log.v(this.toString(), "write mode: " + writeMode); if (NfcAdapter.ACTION_TAG_DISCOVERED.equals(intent.getAction()) && writeMode == true) { Tag mytag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); Log.v(this.toString(), "Detected tag: " + mytag.toString()); Log.v(this.toString(), "techlist:" + mytag.getTechList()); ArrayList<Quickpublish> qps = adapter.getValues(); if (qps.size() < 1) { publishProgress(getResources().getString(R.string.nfcWriteDialogTagNoContent), false); return; }/* w w w .j a v a2s . c om*/ if (write(Quickpublish.toJsonString(qps), mytag)) { Log.v(this.toString(), "Write ok"); publishProgress(getResources().getString(R.string.nfcWriteDialogTagSuccess), true); } else { Log.e(this.toString(), "Write fail"); } } }