List of usage examples for android.content Context NFC_SERVICE
String NFC_SERVICE
To view the source code for android.content Context NFC_SERVICE.
Click Source Link
From source file:Main.java
/** * Return the NfcAdapter object or null. All devices without a hardware NFC module * will return null. All devices with Android 2.3.0 (API 9) or lower will return null, * caused by missing API support. // w ww . j av a2s . co m * * @param context Android Context * @return NfcAdapter object or null */ @SuppressLint("NewApi") public static NfcAdapter getNfcAdapter(Context context) { if (Build.VERSION.SDK_INT < MIN_SDK_INT_FOR_NFC) { return null; } else { final NfcManager manager = (NfcManager) context.getSystemService(Context.NFC_SERVICE); final NfcAdapter adapter = manager.getDefaultAdapter(); return adapter; } }
From source file:org.openhab.habdroid.ui.OpenHABWriteTagActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { Util.setActivityTheme(this); super.onCreate(savedInstanceState); setContentView(R.layout.openhabwritetag); Toolbar toolbar = findViewById(R.id.openhab_toolbar); setSupportActionBar(toolbar);//from w w w. ja va2 s. c o m getSupportActionBar().setDisplayHomeAsUpEnabled(true); NfcManager manager = (NfcManager) getSystemService(Context.NFC_SERVICE); mNfcAdapter = manager.getDefaultAdapter(); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction().add(R.id.writenfc_container, getFragment()).commit(); } setResult(RESULT_OK); mSitemapPage = getIntent().getStringExtra("sitemapPage"); Log.d(TAG, "Got sitemapPage = " + mSitemapPage); mItem = getIntent().getStringExtra("item"); Log.d(TAG, "Got item = " + mItem); mCommand = getIntent().getStringExtra("command"); Log.d(TAG, "Got command = " + mCommand); }
From source file:cc.mintcoin.wallet.ui.WalletAddressFragment.java
@Override public void onAttach(final Activity activity) { super.onAttach(activity); this.activity = (FragmentActivity) activity; this.application = (WalletApplication) activity.getApplication(); this.config = application.getConfiguration(); this.nfcManager = (NfcManager) activity.getSystemService(Context.NFC_SERVICE); }
From source file:com.kncwallet.wallet.ui.WalletAddressFragment.java
@Override public void onAttach(final Activity activity) { super.onAttach(activity); this.activity = (FragmentActivity) activity; this.application = (WalletApplication) activity.getApplication(); this.prefs = PreferenceManager.getDefaultSharedPreferences(activity); this.nfcManager = (NfcManager) activity.getSystemService(Context.NFC_SERVICE); }
From source file:de.schildbach.wallet.elysium.ui.WalletAddressFragment.java
@SuppressLint("InlinedApi") @Override/* w w w .ja va 2 s .c o m*/ public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { nfcManager = activity.getSystemService(Context.NFC_SERVICE); final View view = inflater.inflate(R.layout.wallet_address_fragment, container, false); elysiumAddressButton = view.findViewById(R.id.elysium_address_button); elysiumAddressLabel = (TextView) view.findViewById(R.id.elysium_address_label); elysiumAddressQrView = (ImageView) view.findViewById(R.id.elysium_address_qr); elysiumAddressButton.setOnClickListener(new OnClickListener() { public void onClick(final View v) { AddressBookActivity.start(activity, false); } }); elysiumAddressQrView.setOnClickListener(new OnClickListener() { public void onClick(final View v) { handleShowQRCode(); } }); elysiumAddressQrView.setOnLongClickListener(new OnLongClickListener() { public boolean onLongClick(final View v) { startActivity(new Intent(activity, RequestCoinsActivity.class)); return true; } }); return view; }
From source file:de.schildbach.wallet.goldcoin.ui.WalletAddressFragment.java
@SuppressLint("InlinedApi") @Override//from w w w . j a va 2 s . co m public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { nfcManager = activity.getSystemService(Context.NFC_SERVICE); final View view = inflater.inflate(R.layout.wallet_address_fragment, container, false); litecoinAddressButton = view.findViewById(R.id.goldcoin_address_button); litecoinAddressLabel = (TextView) view.findViewById(R.id.goldcoin_address_label); litecoinAddressQrView = (ImageView) view.findViewById(R.id.goldcoin_address_qr); litecoinAddressButton.setOnClickListener(new OnClickListener() { public void onClick(final View v) { AddressBookActivity.start(activity, false); } }); litecoinAddressQrView.setOnClickListener(new OnClickListener() { public void onClick(final View v) { handleShowQRCode(); } }); litecoinAddressQrView.setOnLongClickListener(new OnLongClickListener() { public boolean onLongClick(final View v) { startActivity(new Intent(activity, RequestCoinsActivity.class)); return true; } }); return view; }
From source file:de.schildbach.wallet.litecoin.ui.WalletAddressFragment.java
@SuppressLint("InlinedApi") @Override// w w w .j av a2s.c o m public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { nfcManager = activity.getSystemService(Context.NFC_SERVICE); final View view = inflater.inflate(R.layout.wallet_address_fragment, container, false); litecoinAddressButton = view.findViewById(R.id.litecoin_address_button); litecoinAddressLabel = (TextView) view.findViewById(R.id.litecoin_address_label); litecoinAddressQrView = (ImageView) view.findViewById(R.id.litecoin_address_qr); litecoinAddressButton.setOnClickListener(new OnClickListener() { public void onClick(final View v) { AddressBookActivity.start(activity, false); } }); litecoinAddressQrView.setOnClickListener(new OnClickListener() { public void onClick(final View v) { handleShowQRCode(); } }); litecoinAddressQrView.setOnLongClickListener(new OnLongClickListener() { public boolean onLongClick(final View v) { startActivity(new Intent(activity, RequestCoinsActivity.class)); return true; } }); return view; }
From source file:de.schildbach.wallet.marscoin.ui.WalletAddressFragment.java
@SuppressLint("InlinedApi") @Override/* www .ja v a 2s.c o m*/ public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { nfcManager = activity.getSystemService(Context.NFC_SERVICE); final View view = inflater.inflate(R.layout.wallet_address_fragment, container, false); marscoinAddressButton = view.findViewById(R.id.marscoin_address_button); marscoinAddressLabel = (TextView) view.findViewById(R.id.marscoin_address_label); marscoinAddressQrView = (ImageView) view.findViewById(R.id.marscoin_address_qr); marscoinAddressButton.setOnClickListener(new OnClickListener() { public void onClick(final View v) { AddressBookActivity.start(activity, false); } }); marscoinAddressQrView.setOnClickListener(new OnClickListener() { public void onClick(final View v) { handleShowQRCode(); } }); marscoinAddressQrView.setOnLongClickListener(new OnLongClickListener() { public boolean onLongClick(final View v) { startActivity(new Intent(activity, RequestCoinsActivity.class)); return true; } }); return view; }
From source file:de.schildbach.wallet.worldcoin.ui.WalletAddressFragment.java
@SuppressLint("InlinedApi") @Override/*from www .j av a 2 s. c o m*/ public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { nfcManager = activity.getSystemService(Context.NFC_SERVICE); final View view = inflater.inflate(R.layout.wallet_address_fragment, container, false); worldcoinAddressButton = view.findViewById(R.id.worldcoin_address_button); worldcoinAddressLabel = (TextView) view.findViewById(R.id.worldcoin_address_label); worldcoinAddressQrView = (ImageView) view.findViewById(R.id.worldcoin_address_qr); worldcoinAddressButton.setOnClickListener(new OnClickListener() { public void onClick(final View v) { AddressBookActivity.start(activity, false); } }); worldcoinAddressQrView.setOnClickListener(new OnClickListener() { public void onClick(final View v) { handleShowQRCode(); } }); worldcoinAddressQrView.setOnLongClickListener(new OnLongClickListener() { public boolean onLongClick(final View v) { startActivity(new Intent(activity, RequestCoinsActivity.class)); return true; } }); return view; }
From source file:de.schildbach.wallet.digitalcoin.ui.WalletAddressFragment.java
@SuppressLint("InlinedApi") @Override//from w ww . ja v a 2 s. c o m public View onCreateView(final LayoutInflater inflater, final ViewGroup container, final Bundle savedInstanceState) { nfcManager = activity.getSystemService(Context.NFC_SERVICE); final View view = inflater.inflate(R.layout.wallet_address_fragment, container, false); digitalcoinAddressButton = view.findViewById(R.id.digitalcoin_address_button); digitalcoinAddressLabel = (TextView) view.findViewById(R.id.digitalcoin_address_label); digitalcoinAddressQrView = (ImageView) view.findViewById(R.id.digitalcoin_address_qr); digitalcoinAddressButton.setOnClickListener(new OnClickListener() { public void onClick(final View v) { AddressBookActivity.start(activity, false); } }); digitalcoinAddressQrView.setOnClickListener(new OnClickListener() { public void onClick(final View v) { handleShowQRCode(); } }); digitalcoinAddressQrView.setOnLongClickListener(new OnLongClickListener() { public boolean onLongClick(final View v) { startActivity(new Intent(activity, RequestCoinsActivity.class)); return true; } }); return view; }