Created
November 9, 2017 13:47
-
-
Save ssaurel/869a5ffd4f2934f9bca0253d27bda19d to your computer and use it in GitHub Desktop.
onCreate method for the NFC Reader Tutorial
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Override | |
protected void onCreate(Bundle savedInstanceState) { | |
super.onCreate(savedInstanceState); | |
setContentView(R.layout.activity_main); | |
text = (TextView) findViewById(R.id.text); | |
nfcAdapter = NfcAdapter.getDefaultAdapter(this); | |
if (nfcAdapter == null) { | |
Toast.makeText(this, "No NFC", Toast.LENGTH_SHORT).show(); | |
finish(); | |
return; | |
} | |
pendingIntent = PendingIntent.getActivity(this, 0, | |
new Intent(this, this.getClass()) | |
.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP), 0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment