Android activity hangs until a disconnect event is received


I’ve implemented Muse in an Android activity. I start it using mMuse.runAsynchronously();

If I start a connection (for instance to a headset that is off, so it never actually connects) and then exit the activity, the activity goes away but the original activity which started the muse activity won’t accept any keyboard entry until I received a CONNECTING -> DISCONNECTED event from muse.

Looking into this I found that the Muser activities onStop() event is not bing called until I get the CONNECTING -> DISCONNECTED event from muse.

Any ideas on hnow to fix this?


Found the problem. I was calling muse.disconnect() in the activies onStop(). Aparently muse.disconnect() is blocking and therefore the UI would hang in onStop() until it returned. Calling muse.disconnect() from an async thread fixed it.