return early if cannot init adapter
[YkNeoCR.git] / src / org / average / nfcauthcr / NfcCRdispatch.java
index d5342f018fce227d7f2e91ba85f332a46911c1bb..3216ef642a3b1dc126ec316a95036c9a3fee66e3 100644 (file)
@@ -55,7 +55,7 @@ public class NfcCRdispatch {
                return null;
        }
 
-       public void onResume(ArrayList<String> challenge) {
+       public boolean onResume(ArrayList<String> challenge) {
                this.challenge = challenge;
                Intent intent = activity.getIntent();
                intent.addFlags(Intent.FLAG_ACTIVITY_SINGLE_TOP);
@@ -68,16 +68,17 @@ public class NfcCRdispatch {
                if (adapter == null) {
                        Toast.makeText(activity, R.string.no_nfc,
                                                Toast.LENGTH_LONG).show();
-                       return;
+                       return false;
                }
                if (!adapter.isEnabled()) {
                        Toast.makeText(activity, R.string.nfc_disabled,
                                                Toast.LENGTH_LONG).show();
-                       return;
+                       return false;
                }
                adapter.enableForegroundDispatch(activity, tagIntent,
                                        new IntentFilter[] {iso},
                                        new String[][] {techs});
+               return true;
        }
 
        public void onPause() {