Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Multiple File Selector/Chooser Dialog

I have been scouring the internet for a simple easy to implement Android file chooser dialog that also has the option of selecting multiple files and returning a uri or string array with all the files selected.

Currently I use aFileChooser on github and it is according to me better than android-file-dialog. But neither address the issue of passing multiple files.

I am only an intermediate android developer but I think this would be something not so hard to implement by a pro.

I have looked at the code of aFileChooser and I think adding a check box to the file item would be the way to go but as far as code is concerned i am clueless and the developer seems he's not really gonna work on it in the foreseeable future

So in short im requesting for help to either add the select multiple files option to aFileChooser via the github or here, or maybe suggest to me a better dialog that does what i want.

like image 668
Asiimwe Avatar asked Feb 28 '14 12:02

Asiimwe


2 Answers

Thank's to the answer above, I've made a simple library that addresses the concern. It not only passes an array of file paths but you can also use to select a folder.

  • It has thumbnails for image files
  • auto scrolls to last scroll position
  • will soon have language support for several locales

Here it is: https://github.com/tapaulo/Android-Multiple-file-Selector-Dialog

enter image description here

like image 123
Asiimwe Avatar answered Oct 07 '22 21:10

Asiimwe


I don't know any file chooser you could use, but I can show you how I made my own long time ago. It's actually pretty ugly, but it does what you ask for. You can select multiple files and an ArrayList<File> is returned via Intent.

So you could use it as an example of how to do it, and implement it yourself, if you really need it to (I wouldn't recommend you to use mine as it is now).

Here are the links to GitHub:

  • FileSelectionActivity.
  • Used layout file for the FileSelectionActivity.
  • MainActivity, on line 225 the FileSelectionActivity is started.

Below there's a screenshot of FileSelectionActivity, as I said, ugly.

"Go Up" goes to a higher level of the file hierarchy, there are two ListViews, one for directories and one for files. The files have checkboxes. When the share button is pressed, each item in the second ListView is checked to see if the checkbox is active or not. That's line 71 of the FileSelectionActivity file.

FileSelectionActivity on phone

Anyways, I hope this helps you make your own file selector, or something.

like image 21
ArianJM Avatar answered Oct 07 '22 20:10

ArianJM