mAdapter.enableForegroundNdefPush(MainActivity.this, getNoteAsNdef()); mAdapter.enableForegroundDispatch(this, mNfcPendingIntent, mNdefExchangeFilters, null); } private void disableNdefExchangeMode() { mAdapter.disableForegroundNdefPush(this); mAdapter.disableForegroundDispatch(this); } @Override protected void onPause() { super.onPause(); mResumed = false; mAdapter.disableForegroundNdefPush(this); } @Override public boolean onCreateOptionsMenu(Menu menu) { // Inflate the menu; this adds items to the action bar if it is present.