aFileDialog is an Android library which implements a simple and easy to use file chooser.
His main features are:
- The file chooser can be opened both as a Dialog or as an Activity.
- You can filter the files using regular expressions.
- Can select files or folders.
- Can create files and folders.
In order to use aFileDialog in your application you must do three steps:
1) Add a reference to the library project (which is located in the library folder). Note that, since aFileDialog is a Android Library project, it can not be compiled into a binary file (such as a JAR file), so your project must reference to the aFileDialog project, instead of reference to a single JAR file.
2) Declare the activity FileChooserActivity in the manifest file. This can be done by adding the following lines inside the tags <application></application>
:
<activity android:name="ar.com.daidalos.afiledialog.FileChooserActivity" />
3) Add the permission READ_EXTERNAL_STORAGE to the manifest file, if you want to access the SD card (and if you are using Android 4.1 or superior).
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
Then you must only create an instance of FileChooserDialog and call the show() method or start the activity FileChooserActivity.
In the demo folder who will find the project of a sample app that makes uses of aFileDialog.
You can also install this demo app from Google Play.
aFileDialog has been designed in order to be easy to use and easy to develop.
In order to known how to use aFileDialog, check the user guide (also available in Spanish and French).
If you want to modify or extend aFileDialog, you can read the software design description (also available in Spanish), although this is not mandatory, since the code is fully commented and you are going to figure out how it works in matters of minutes.
Samples codes are available in the user guide, but, to summarize, you can open a file chooser (implemented with a Dialog) using the following lines:
FileChooserDialog dialog = new FileChooserDialog(context);
dialog.show();
To open a file chooser implemented with an Activity, you can use the following lines:
Intent intent = new Intent(this, FileChooserActivity.class);
this.startActivityForResult(intent, 0);
This library is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License along with this library; If not, see http://www.gnu.org/licenses/.