Android Question GET FILE WITH DIALOGUE

Herbert Souza

Member
Licensed User
Longtime User
Help me.

I have an application that takes a picture and upa for a url, to scan OCR, currently it takes the file from my internal directory, I need to make him take a picture of a file selection. how I do it?

Line current code is:
B4X:
myOCR.ExtractFromImage(File.Combine(File.DirAssets, "sample.gif"), "", "scene", 20000)

And I already have a button that opens a dialog to choose the file, I just need it to use the file you chose to select if my file "sample.gif"

My dialogue box:
B4X:
Dim fd As FileDialog
    fd.FastScroll = True
    'fd.ShowOnlyFolders = True
    fd.FilePath = File.DirRootExternal ' also sets ChosenName to an emtpy string
    'fd.ShowOnlyFolders = True
    'fd.FileFilter = ".txt" ' for example or ".jpg,.png" for multiple file types
    ret = fd.Show("B4A File Dialog", "Yes", "No", "Maybe", Bmp)   
    ToastMessageShow(ret & " : Path : " & fd.FilePath & CRLF & "File : " & fd.ChosenName, False)


Can someone give me a light?

Sorry - me, I'm new in B4A.
 

DonManfred

Expert
Licensed User
Longtime User
try it like this...

B4X:
ret = fd.Show("B4A File Dialog", "Yes", "No", "Maybe", Bmp) 
ToastMessageShow(ret & " : Path : " & fd.FilePath & CRLF & "File : " & fd.ChosenName, False)
myOCR.ExtractFromImage(File.Combine(fd.FilePath, fd.ChosenName), "", "scene", 20000)
 
Upvote 0
Top