B4A Class Camera Folder (or other dir) Image File Chooser - XUI - xCLV

Discussion in 'Additional libraries, classes and official updates' started by Harris, Dec 1, 2018.

  1. Harris

    Harris Well-Known Member Licensed User

    Inspired by (and code used) from this thread...
    https://www.b4x.com/android/forum/threads/filepicker.96795/

    I needed an image picker to get camera photos when the user took pictures outside my app - but wants to include these camera images (one or more)... You can modify to choose any type of file. Scales to any device density.

    xCustomListView is so powerful and I use it, more often than not for all new projects and UI classes.

    This example starts by showing JPG or PNG files in the [DCIM/Camera] folder. It will load the first 20 images (or less) found in the folder.
    Every selected image is added to a map (or de-selected - removed from map) - which is returned to the Wait For....
    The Prev / Next buttons show the available (20) images...
    The (back) ../Camera will allow to select a different directory.

    Screenshot_20181130-231000.jpg

    Since each list item thumbnail is hard to view, clicking the imageview will show a larger image.

    Screenshot_20181130-231058.jpg

    With a little work, please make this iOS usable and post your results...

    Example Use:
    Code:
    Sub sInputList_Show_Click

      
    Log(" waiting here for result")
     
      
    Wait For (imgFP.WaitForResult) Complete (Result As Map)
     
      
    Log(" was waiting here - got result "&Result)

      
    If Result.Size > 0 Then  ' show images from map - or do what you want (like post to a server)
          For i = 0 To Result.Size - 1
           UpdIv(Result.GetValueAt(i), Result.GetKeyAt(i))
           Sleep(
    3000)     
         
    Next
          
    ToastMessageShow(" All Selected Images Were Shown",True)   
      
      
    Else
          
    ToastMessageShow(" nothing was selected",True)   
      
    End If


    End Sub
    Full Example project (and class) in attached zip...
     

    Attached Files:

    Last edited: Dec 1, 2018
  2. Harris

    Harris Well-Known Member Licensed User

    Reserved for class updates...

    Updated imgFilePick class to use XUI standards.
    Changed bitmap to B4XBitmap (thanks to Klaus for pointing this out in other threads)
    Changed .color to xui.color
    Fixed Cancel button to break from loop and return the empty map (complete the Main Wait For)
    Added many comments to code...

    Thanks
     

    Attached Files:

    Last edited: Dec 2, 2018
    Erel likes this.
  3. Harris

    Harris Well-Known Member Licensed User

    Updated class in above post...
     
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