Android Question GET FILE WITH DIALOGUE

Discussion in 'Android Questions' started by Herbert Souza, Jun 30, 2015.

  1. Herbert Souza

    Herbert Souza Member Licensed 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:
    Code:
    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:
    Code:
    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.
     
  2. DonManfred

    DonManfred Expert Licensed User

    try it like this...

    Code:
    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)
     
    Devan, Erel and Peter Simpson like this.
  3. Herbert Souza

    Herbert Souza Member Licensed User

    Thanks a lot, man, congratulations.
     
Loading...