B4A Library FilePicker

Discussion in 'Additional libraries, classes and official updates' started by DonManfred, Jul 19, 2016.

  1. DonManfred

    DonManfred Expert Licensed User

    This is a wrap for this github project.

    The lib requires B4A 6+

    This is my 100. Library-Release for B4A :)

    FilePicker
    Author:
    DonManfred (wrapper)
    Version: 1.01
    • DialogProperties
      Methods:
      • Initialize (EventName As String, root As String, selectionMode As Int, selectionType As Int, extensions() As String)
        Selection Mode defines whether a single of
        multiple Files/Directories have to be selected.
        SINGLE_MODE and MULTI_MODE are the two selection modes,
        See DialogConfigs for more info.
        Set to Single Mode by default.

        Selection Type defines that whether a File/Directory or both of these has
        has to be selected.

        FILE_SELECT ,DIR_SELECT, FILE_AND_DIR_SELECT are the three selection modes,
        See DialogConfigs for more info. Set to FILE_SELECT by default.

        root = The Parent/Root Directory. List of Files are populated from here.
        Can be set to any readable directory. /sdcard is the default location.

        extensions = An Array of String containing extensions, Files with only that will be shown.
        Others will be ignored. Set to null by default.
        Eg. String ext={"jpg","jpeg","png","gif"};
      • IsInitialized As Boolean
    • FileListItem
      Methods:
      • Initialize (EventName As String)
      • IsInitialized As Boolean
      • compareTo (fileListItem As FileListItem) As Int
      • isDirectory As Boolean
      • isMarked As Boolean
      Properties:
      • Directory As Boolean [write only]
      • Filename As String
      • Location As String
      • Marked As Boolean [write only]
      • Time As Long
    • FilePickerDialog
      Events:
      • _onSelectedFilePaths (selected[] As String)
      Methods:
      • Initialize (EventName As String)
      • IsInitialized As Boolean
      • cancel
      • closeOptionsMenu
      • dismiss
      • openContextMenu (view As View)
      • openOptionsMenu
      • show
      Properties:
      • Properties As DialogProperties
     

    Attached Files:

    Last edited: May 31, 2018
    SJQ, KMatle, Sandman and 29 others like this.
  2. Peter Simpson

    Peter Simpson Expert Licensed User

    Congratulations @DonManfred, you've reached the big Ton.

    We can all learn a lot from you matey :)
     
    sonicmayne and DonManfred like this.
  3. MarcoRome

    MarcoRome Expert Licensed User

    +50 ;) Great Don....and Congratulations for your wonderful library 100 :D:D
     
    sonicmayne and DonManfred like this.
  4. Erel

    Erel Administrator Staff Member Licensed User

    Great work Don!
     
    sonicmayne, MarcoRome and DonManfred like this.
  5. susu

    susu Well-Known Member Licensed User

    Congratulation! 100th libraries! :)
     
    sonicmayne and DonManfred like this.
  6. moster67

    moster67 Expert Licensed User

    Thumbs up Don! 100 libraries is a nice achievement.
    We're in luck to have you here!
     
    sonicmayne and MarcoRome like this.
  7. so27

    so27 Active Member Licensed User

    Hello DonManfred,

    I opened your example file, but can not select files in a folder. Why is that?

    See Video..
     
  8. DonManfred

    DonManfred Expert Licensed User

    check the parameters in initialize... you can set only folders, only files, both....
     
  9. so27

    so27 Active Member Licensed User

    I could not see the fields. White on white. I set in the manifest file some material colors and already I see the check boxes. Thanks.
     
  10. asales

    asales Well-Known Member Licensed User

    Congratulations for you 100th library and thanks!
     
  11. ivan.tellez

    ivan.tellez Active Member Licensed User

    This could be useful:

    Code:
    '  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;
     
  12. JoanRPM

    JoanRPM Active Member Licensed User

    Hello.

    I'm trying to use this library, bu I have a compiler error:

    B4A version: 6.00
    Parsing code. (0.02s)
    Compiling code. (0.16s)
    Compiling layouts code. (0.00s)
    Organizing libraries. (0.00s)
    Generating R file. Error
    C:\Projectes\Prog\Proves\Android\FilePicker\FilePicker\Objects\bin\extra\res1\res\layout\dialog_file_list_item.xml:12: error: No resource identifier found for attribute 'layout_marginStart' in package 'android'
    C:\Projectes\Prog\Proves\Android\FilePicker\FilePicker\Objects\bin\extra\res1\res\layout\dialog_file_list_item.xml:21: error: No resource identifier found for attribute 'layout_marginStart' in package 'android'
    C:\Projectes\Prog\Proves\Android\FilePicker\FilePicker\Objects\bin\extra\res1\res\layout\dialog_header.xml:9: error: No resource identifier found for attribute 'layout_marginStart' in package 'android'
    C:\Projectes\Prog\Proves\Android\FilePicker\FilePicker\Objects\bin\extra\res1\res\layout\dialog_header.xml:23: error: No resource identifier found for attribute 'layout_marginStart' in package 'android'
    C:\Projectes\Prog\Proves\Android\FilePicker\FilePicker\Objects\bin\extra\res1\res\layout\dialog_header.xml:33: error: No resource identifier found for attribute 'layout_marginStart' in package 'android'

    I put the 3 files "FilePickerV1.01.zip" in the Library folder.

    What can I do?

    Thanks.
     
  13. DonManfred

    DonManfred Expert Licensed User

    Give us more info. which Android Version are you running on your device?
    Which android jar (API) are you using?
    What is the target sdk in manifest?
     
  14. JoanRPM

    JoanRPM Active Member Licensed User

    DonManfred.

    It's your example.
    Android Version is 4.4.2.

    The problem is the jar API. I change to API 19 and it works.

    Thanks.
     
    Last edited: Aug 5, 2016
  15. cb56

    cb56 Member Licensed User

    Great work!
    Only one thing ...could you disable the "Select" button if nothing is selected?

    Thanks

    Edit: Another tip: can you increase the size of the check? Often it happens to enter the folder instead of select it.
    Even touching the check right should not enter the folder.

    It would be a useful option to change the color of the folder, the background and text.

    Thanks
     
    Last edited: Oct 16, 2016
  16. MitchBu

    MitchBu Active Member Licensed User

    Hi DonManfred,

    I would like to use your superb FilePicker to select pictures to load into an ImageView, but I am stuck figuring out path and filename to do this kind of thing fictitious path and filename) :
    Code:
    ImageView1.Bitmap = LoadBitmap(File.DirRootExternal, "myPic.png")
     
  17. MitchBu

    MitchBu Active Member Licensed User

    I will reply to my own question in case someone else had the same question.

    It works by putting the complete path as first argument, and nothing in filename :
    Code:
    ImageView1.Bitmap = LoadBitmap(selected(0), "")
     
  18. Erel

    Erel Administrator Staff Member Licensed User

    It is better to use LoadBitmapSample. Bitmaps can be very large and will consume all the available memory.
     
  19. MitchBu

    MitchBu Active Member Licensed User

    You are right of course. I did not know about it.

    Thank you, Erel.
     
  20. Robert Valentino

    Robert Valentino Well-Known Member Licensed User

    it possible to use this library with B4J

    I am trying but keep getting Cannot find: C:\Program Files (x86)\Anywhere Software\B4J\libraries\filepicker-1.0.1.aar.jar

    I have the file in my B4J additional libraries
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice