Android Question SOLVED - Close dialog with a Yes, No, Cancel - Voice command

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Wait For CloseMessage(Result As Int) in a Custom Dialog is there any way the user can close with a Yes, No, Cancel - Voice command

I am waiting for user to click on either Cancel, Yes, No and was wondering how I could handle them saying Cancel, Yes or No with their voice as well.

I am confused because I am waiting for their input so there isn't a way for me to have a voice session waiting as well (we there is if I make a background server)

Using the SpeechRecognitionNoUI my thought was that when I do the Voice.Listen and get the message "ReadyForSpeech" that I would then call the waif to close message on the dialog

What would be the proper way to do this. Again allow Cancel, Yes & No clicking and/or Cancel, Yes & No by voice
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
What I did is use call sub delay to call a routine to start listening. Then fall into my Wait for response
B4X:
            #if _VoiceCmds_
            CallSubDelayed(Me, "Listen")
            #End If
           
            Wait For CloseMessage(Result As Int)

The call sub delay gets fired off while I am waiting for the CloseMessage and it fires off a wait for voice response
B4X:
               Wait For VoiceInput_Results(Texts As List)

In voice response if it finds a hit (cancel, yes, no) it calls CloseMessage
B4X:
               CallSubDelayed2(Me, "CloseMessage", mCommands.Get(Command))

This seems to work fine.
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Not sure how to do that with CloseMessage and voice results.

Can you provide an example.

I do not even know where CloseMessage is defined but I know it works like JobDone (https://www.b4x.com/android/forum/threads/b4xdialog-statement-and-question.101527/#content).

is it as simple as
B4X:
wait for (CloseMessage) Complete(Result as int)
instead of
B4X:
wait for (CloseMessage(Result as Int)

I believe I got the
B4X:
 wait for CloseMessage(Result as Int)
from an example you posted (maybe not, but I think so)
 
Upvote 0
Top