Android Question TTS while listing files on SD card

Tim Chapman

Active Member
Licensed User
Longtime User
I need to list files on a microsd card and compare the list to a previous list of files on the same SD card to see if any files have changed.
I don't want to have to pause the code while this happens.
The code sends a request to OpenAI and waits for a response. I don't know that there would be time enough while waiting to do the file checking.
After the AI responds, the user will press a button to read the response using TTS.
Is there a way to make the file checking occur while the TTS is reading? There should be plenty of time then while the TTS reads.
How to make Android do two things at once. I tried threading, but got the error: b4a Exception : Wrong number of arguments; expected 4, got 0
This error seems to be common and I have not found an answer for it.
I understand that there may be simpler ways to do this without threading, but I don't know what they would be.
 
Solution
Before you choose the design, you need to make some measurements and find the steps that are actually slow.

Note that TTS and HttpJob are asynchronous.
Top