Reply To: What does registerActivity do?

Forum MIFARE general topics and applications What does registerActivity do? Reply To: What does registerActivity do?

Re: What does registerActivity do?

14. December 2016 at 15:36
Yes, I followed the application note tutorial, and even downloaded the source code, but there there is only one activity, not multiple.

Here is the error regarding the dispatch:


--------- beginning of crash
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.SOMETHING.SOMETHING.debug, PID: 8608
java.lang.RuntimeException: Unable to resume activity {com.SOMETHING.SOMETHING.debug/com.SOMETHING.SOMETHING.mypackagename.AnActivityThatIsntMainActivity}: java.lang.IllegalStateException: Foreground dispatch can only be enabled when your activity is resumed
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3160)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3191)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2529)
at android.app.ActivityThread.access$900(ActivityThread.java:154)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:234)
at android.app.ActivityThread.main(ActivityThread.java:5526)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
Caused by: java.lang.IllegalStateException: Foreground dispatch can only be enabled when your activity is resumed
at android.nfc.NfcAdapter.enableForegroundDispatch(NfcAdapter.java:1200)
at com.nxp.nfclib.NxpNfcLib.startForeGroundDispatch(:4065)
at com.SOMETHING.SOMETHING.mypackagename.NFCActivityUpInTheHierarchy.onResume(NFCActivityUpInTheHierarchy.kt:77)
at android.app.Instrumentation.callActivityOnResume(Instrumentation.java:1259)
at android.app.Activity.performResume(Activity.java:6361)
at android.app.ActivityThread.performResumeActivity(ActivityThread.java:3149)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3191) 
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2529) 
at android.app.ActivityThread.access$900(ActivityThread.java:154) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1391) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:234) 
at android.app.ActivityThread.main(ActivityThread.java:5526) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

+ 0  |  - 0