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

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:
B4X:
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...
 

Attachments

  • imgFP.zip
    22.9 KB · Views: 491
Last edited:

Harris

Expert
Licensed User
Longtime 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
 

Attachments

  • imgFilePick.bas
    14 KB · Views: 396
Last edited:

Harris

Expert
Licensed User
Longtime User
Updated class in above post...
 
Top