Android Question FilePicker Dialog

Meuke

Member
Licensed User
Hello,
Having trouble with selection of a file in FilePicker Dialog.
When running the program I can see a window with all the folders in a dialog window.
After selecting a map, I can see the files in the map.
But when trying to select a file nothing happens.
All I can do is use the button Cancel to get out of the dialog window.
How can I retrieve the file that I want to select?

The code I used is :
'*************************************************************************************************************
Dim fp As FilePickerDialog

Dim props As DialogProperties
' SELECTION_MODES
' SINGLE_MODE specifies that a single File/Directory has to be selected
' from the list of Files/Directories. It is the default Selection Mode.
Dim Const SINGLE_MODE As Int = 0
' MULTI_MODE specifies that multiple Files/Directories has to be selected
' from the list of Files/Directories.
Dim Const MULTI_MODE As Int = 1
' SELECTION_TYPES
' FILE_SELECT specifies that from list of Files/Directories a File has to be selected.
Dim Const FILE_SELECT As Int = 0
' DIR_SELECT specifies that from list of Files/Directories a Directory has to be selected.
'It is the default Selection Type.
Dim Const DIR_SELECT As Int = 1
' FILE_AND_DIR_SELECT specifies that from list of Files/Directories both can be selected.
Dim Const FILE_AND_DIR_SELECT As Int = 2
props.Initialize("",File.DirRootExternal,0,0,Array As String(".txt",".pdf"))
fp.Initialize("FilePicker")
fp.Properties = props

fp.show
'*************************************************************************************************************
 

DonManfred

Expert
Licensed User
Longtime User
Please use [CODE]code here...[/CODE] tags when posting code.

codetag001.png

codetag002.png

codetag003.png



But when trying to select a file nothing happens.

Are you handling the Event?

B4X:
Sub FilePicker_onSelectedFilePaths(selected() As String)
    Log($"FilePicker_onSelectedFilePaths(${selected.Length})"$)  
    For i = 0 To selected.Length -1
        Log($"${selected(i)}"$)
    Next
    fp.dismiss
End Sub

PS: Welcome to the B4X Community
 
Last edited:
Upvote 0

Meuke

Member
Licensed User
Sorry but I am still new to this...
What code do I have to use after “fp.show”
How do I call the sub FilePicker_onSelectedFilePaths(selected() As String).....
 
Upvote 0
Top