Android Question File browser - all in white?

Status
Not open for further replies.

JeffT

Member
Licensed User
In 2 projects, I use the same code.
In one of them the file browser dialog appears with white letters on a black background - great.
In the other, using the same code, its white -ish on a white background.. the folder and file names are almost unreadable.

ANy idea why the difference and how to address it?

B4X:
    Try
        Dim fd As FileDialog
        fd.FilePath = File.DirRootExternal
        Dim sf As Object = fd.ShowAsync("Select file", "Open", "Cancel", "", Null, False)
        Wait For (sf) Dialog_Result(Result As Int)
        If Result = DialogResponse.POSITIVE Then
            
    'Do stuff with the file here
        End If

    Catch
        Log ("Error opening file chooser")
    End Try
 

DonManfred

Expert
Licensed User
Longtime User
Theme?
 
Upvote 0

JeffT

Member
Licensed User
(newbie)

Whats a theme?
Same device, same PC, one project (the white one) uses B4XPages the other does not.
I dont know where to change or set a theme.
 
Upvote 0

JeffT

Member
Licensed User
I found manifest editor, and yes- the themes were different .. no idea why.
Set it to dark and it looks fine now.

Thanks all!
But based on this, I cant see why anyone would use light - the file dialog is unusable in that mode.
 
Upvote 0

JeffT

Member
Licensed User
Thanks Erel.
I'll look into that.
If Google hides the file system, how is a user expected to access a document created on another device?

Content Chooser examples I have seen all seem to focus on being able to get an image. Thats not what I need. The files I want are text/binary files
 
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
This gives you access to everything:
B4X:
Sub Class_Globals
    Private Root As B4XView
    Private xui As XUI
    Private CC As ContentChooser
End Sub

Public Sub Initialize
    CC.Initialize("CC")
End Sub

Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1
    Root.LoadLayout("MainPage")
End Sub


Sub Button1_Click
    CC.Show("*/*", "Choose file")
    Wait For CC_Result (Success As Boolean, Dir As String, FileName As String)
    If Success Then
        
    End If
End Sub
 
Upvote 0

JeffT

Member
Licensed User
Looking at ContentChooser, it appears to suggest that 'some other application needs to be able to provide the content'
I assume that is file explorer? What if there isnt a file explorer?

The docs say:
Mime - The content MIME type.
Title - The title of the chooser dialog (when there is more than one application).
Examples:
CC.Show("image/*", "Choose image")
CC.Show("audio/*", "Choose audio file")


My files don't have a mime type .. how do I handle that?
eg I have a file format that has an extension of (say) TPL .. no other app handles such files...
 
Upvote 0

JeffT

Member
Licensed User
The content chooser gives a nicer looking dialog.
Took a while to change the settings so that I could see my files in a 'Downloads' folder.
But there is a big difference in the way the directory and file names are returned.

File Dialog gives me
Dir = /storage/emulated/0/download
and
filename = Myfile.OXS


Content Chooser gives me
Dir = ContentDir
Filename = content//com.android.externalstorage.documents/document/primary%3ADownload%2FMyfile.OXS


While I can use the values from file dialog to get my file, I cant work out how to use the values from Content Chooser.
Is the presence of the %3A and %2F causing an issue?


File.exists(Dir,Filename) returns false with Content Chooser, and true for the File Dialog


I should add that this target file is an XML file.
What I want to do next is parse it.
 
Last edited:
Upvote 0
Status
Not open for further replies.
Top