Android Question Issue with VoiceRecognition and Activity_Pause

MrKim

Well-Known Member
Licensed User
Longtime User
When I click a button I want to open the mic for speech recognition. I have tried using VoiceRecognition, unfortunately it fires the Activity_Pause and Resume events. I am doing a lot of saving and restoring here which means I am no longer in the EditText which I am trying to put the text into.

When you tap on an edittext the keyboard opens, then you tap the mic and the mic opens, all without firing Activity_Pause or Resume. I can set a flag indicating that I have opened the mic using VoiceRecogition and avoid the code in these events, but my concern is that at some point Android WILL pause my app while my flag is still set and I will lose any changes.

Also, opening it this way does not open the keyboard as well. I tried adding IME.showkeyboard both before
and after VR.Listen but it doesn't happen, probably because the Activity_Pause is happening.

Ideally what I want to do is open the keyboard, then the mic, without user intervention and without firing Activity_Pause/Resume.

Any ideas appreciated.
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
I have tried using VoiceRecognition, unfortunately it fires the Activity_Pause and Resume events. I am doing a lot of saving and restoring here which means I am no longer in the EditText which I am trying to put the text into.
You don't need to do any restoration in Activity_Resume. Only in Activity_Create.
 
Upvote 0
Top