Using the example in this post:
https://www.b4x.com/android/forum/threads/externalstorage-access-sd-cards-and-usb-sticks.90238/
I modified the PickFolder sub to include an "entry" log and an "exit" log tracing:
Now, if the user clicks the PickFolder button, the above code will log "Start SelectDir" and then invoke the method to display the devices "Folder browser".
However, if the user simply presses the back button on their device to abort (not) select a folder and dismiss the Folder Browser selector, the next line of code containing the "Log ("Exit from SelectDir") is never run, leading me to believe the Wait For Line of code is now stuck in an endless loop.
Ultimately, I need to detect if the user aborted the SelectDir action so my app can respond accordingly.
Any ideas?
Here is the log results when a user cancels the .SelectDir via the back button:
https://www.b4x.com/android/forum/threads/externalstorage-access-sd-cards-and-usb-sticks.90238/
I modified the PickFolder sub to include an "entry" log and an "exit" log tracing:
B4X:
Sub btnPickFolder_Click
Log("Start SelectDir")
Storage.SelectDir(chkUsePreviouslySelected.Checked)
Wait For Storage_ExternalFolderAvailable
Log("Exit from SelectDir")
FoldersStack.Clear
EnterFolder(Storage.Root)
End Sub
Now, if the user clicks the PickFolder button, the above code will log "Start SelectDir" and then invoke the method to display the devices "Folder browser".
However, if the user simply presses the back button on their device to abort (not) select a folder and dismiss the Folder Browser selector, the next line of code containing the "Log ("Exit from SelectDir") is never run, leading me to believe the Wait For Line of code is now stuck in an endless loop.
Ultimately, I need to detect if the user aborted the SelectDir action so my app can respond accordingly.
Any ideas?
Here is the log results when a user cancels the .SelectDir via the back button:
B4X:
*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
** Activity (main) Resume **
Start SelectDir
** Activity (main) Pause, UserClosed = false **
sending message to waiting queue (OnActivityResult)
running waiting messages (1)
** Activity (main) Resume **
** Activity (main) Pause, UserClosed = false **
Last edited: