List of usage examples for android.nfc TagLostException printStackTrace
public void printStackTrace()
From source file:net.tjohns.badgescanner.ScanActivity.java
private void scanBadge() { Vibrator vibrator = (Vibrator) getSystemService(Context.VIBRATOR_SERVICE); vibrator.vibrate(VIBRATION_DURATION); Intent intent = getIntent();//w w w . j a v a 2 s .c om if (NfcAdapter.ACTION_TECH_DISCOVERED.equals(getIntent().getAction())) { Tag rawTag = intent.getParcelableExtra(NfcAdapter.EXTRA_TAG); MifareClassic tag = MifareClassic.get(rawTag); try { // Read from badge NfcConnection tagConnection = new NfcConnection(tag, MifareClassic.KEY_DEFAULT); mBadge = new Badge(); mBadge.readFromTag(tagConnection); tagConnection.close(); } catch (TagLostException e) { // TODO(trevorjohns): Convert to dialog Toast.makeText(this, "Tag lost", Toast.LENGTH_LONG); finish(); } catch (IOException e) { // TODO(trevorjohns): Convert to dialog Toast.makeText(this, "IOExcpetion detected", Toast.LENGTH_LONG); e.printStackTrace(); finish(); } } }