B4A Library FileSelect Library With Type Icons

margret

Well-Known Member
Licensed User
Attached is Version 1.02 of my File Selecting library. It includes type icons for most every type of file, creates a selection list which can be collected and produces thumbnails on the fly of image files. Copy the .jar and .xml file to your XtraLibs folder.

Requires: Reflections Library 2.4+, the Reflection lib does not need to be checked in the Libs tab but must be included in your XtraLibs folder or whatever path you have set for them.

Thanks to Stevel05 it moves more swiftly throughout!

Below are a few screen shots and some sample code.

B4X:
Sub Globals
    Dim FS As FileSelect
    FS.Initialize(Activity, Me, True, 0dip, 0dip, 500dip, 600dip)
End Sub
Sub Activity_Create(FirstTime As Boolean)
    FS.ShowFiles("/mnt")
End Sub
 
'Be sure to include this sub in your Activity. This sub
'is called by the Library once a file is selected.
Sub File_Selected(FileName As String, PathAndFile As String)
    Msgbox(FileName, PathAndFile)
End Sub
 

Attachments

Last edited:

margret

Well-Known Member
Licensed User
I think if you create a folder named [ftypes] in the [Files] folder and put the icons there, you can then change them. Here is a list of what the names should be:

12/11/2012 10:54 PM 8,660 3gp.png
12/11/2012 10:54 PM 3,772 apk.png
12/11/2012 10:54 PM 9,148 avi.png
12/11/2012 10:54 PM 4,132 bat.png
12/11/2012 10:54 PM 3,503 dat.png
12/11/2012 10:54 PM 8,075 db.png
12/11/2012 10:54 PM 4,077 doc.png
12/11/2012 10:54 PM 8,859 epub.png
12/11/2012 10:54 PM 10,397 exe.png
12/11/2012 10:54 PM 3,335 folder.png
12/11/2012 10:54 PM 7,011 htm.png
12/11/2012 10:54 PM 8,270 m4a.png
12/11/2012 10:54 PM 14,779 m4v.png
12/11/2012 10:54 PM 7,544 memory.png
12/11/2012 10:54 PM 4,685 mp3.png
12/11/2012 10:54 PM 11,232 mp4.png
12/11/2012 10:54 PM 12,557 ogg.png
12/11/2012 10:54 PM 10,069 pdf.png
12/11/2012 10:54 PM 4,058 text.png
12/11/2012 10:54 PM 12,640 thumb.png
12/11/2012 10:54 PM 3,631 unknown.png
12/11/2012 10:54 PM 7,983 up.png
12/11/2012 10:54 PM 8,519 up2.png
12/11/2012 10:54 PM 12,251 wav.png
12/11/2012 10:54 PM 4,289 xml.png
12/11/2012 10:54 PM 8,438 zip.png
 
Last edited:

merlin2049er

Well-Known Member
Licensed User
How do you return the file path using this? (if a file isn't selected).

I've got a few buttons on the side of this activity (ie. create folder)

Oh, and can you use a long click on this fs? I'd like to use that to delete files...
 

merlin2049er

Well-Known Member
Licensed User
I'd like just the path from that sub file_selected. Or I'd have to strip out the file name and attach the new file name to that whole string so I can pass it to the rename function that I found which uses the phone lib.
 

merlin2049er

Well-Known Member
Licensed User
Thanks! What happens to the FS after the file is selected? It disappears?
 
Last edited:

merlin2049er

Well-Known Member
Licensed User
Hi, how would I handle a long click to a file or folder? I'd like to pop up a dialog and allow for file / folder deletion and maybe renaming.
 

margret

Well-Known Member
Licensed User
Make a copy of the FileSelect.jar file. Rename this copy to FileSelect.zip and open it. Copy the ftypes folder into the Files folder of your project. In the ftypes folder you will see all the icons and can change or copy a new one to the same name but you can not change the name. The library will then use the files in the ftypes folder from the Files folder of your project.
 
Top