|
AndExplorer provides Intents for third party applications. Intents available are:
- Select a file (to open or save as).
- Select a folder (to open or save as).
- Uncompress an archive (ZIP, GZIP, TAR, JAR).
Select file (Open File...):
You have to define an initial folder where file will be selected.
Intent intent = new Intent();
intent.setAction(Intent.ACTION_PICK);
Uri startDir = Uri.fromFile(new File("/sdcard"));
intent.setDataAndType(startDir, "vnd.android.cursor.dir/lysesoft.andexplorer.file");
You can add filename filtering based on file extension:
intent.putExtra("browser_filter_extension_whitelist", "*.jpg,*.mp3,*.zip");
And setup title, colors, font size and list content:
intent.putExtra("explorer_title", "Open File...");
intent.putExtra("browser_title_background_color", "440000AA");
intent.putExtra("browser_title_foreground_color", "FFFFFFFF");
intent.putExtra("browser_list_background_color", "66000000");
intent.putExtra("browser_list_fontscale", "120%");
intent.putExtra("browser_list_layout", "2");
And start the Activity:
startActivityForResult(intent, OPEN_FILE_REQUEST);
Selected file will be returned in onActivityResult method:
Uri selectFile = intent.getData();
|
|
Select file (Save File...):
You have to define an initial folder where file will be saved.
Intent intent = new Intent();
intent.setAction(Intent.ACTION_PICK);
Uri startDir = Uri.fromFile(new File("/sdcard"));
intent.setDataAndType(startDir, "vnd.android.cursor.dir/lysesoft.andexplorer.file");
You can add textfield allowing end-user to fill in filename:
intent.putExtra("browser_line", "enabled");
intent.putExtra("browser_line_textfield", "yourfile.xml");
And setup title and colors:
intent.putExtra("explorer_title", "Save As...");
intent.putExtra("browser_list_background_color", "66000000");
And start the Activity:
startActivityForResult(intent, SAVE_FILE_REQUEST);
Selected file will be returned in onActivityResult method:
Uri selectFile = intent.getData();
|
|
Select folder (Open Folder...):
You have to define an initial folder where folder will be selected and specify type for directories only:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_PICK);
Uri startDir = Uri.fromFile(new File("/sdcard"));
intent.setDataAndType(startDir, "vnd.android.cursor.dir/lysesoft.andexplorer.directory");
You can add textfield allowing end-user to fill in folder name:
intent.putExtra("browser_line", "enabled");
intent.putExtra("browser_line_textfield", "newdirectory");
And setup title:
intent.putExtra("explorer_title", "Save Folder...");
And start the Activity:
startActivityForResult(intent, SAVE_FOLDER_REQUEST);
Selected folder will be returned in onActivityResult method:
Uri selectFile = intent.getData();
|
|
Select folder (Save Folder...):
You have to define an initial folder where folder will be selected and specify type for directories only:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_PICK);
Uri startDir = Uri.fromFile(new File("/sdcard"));
intent.setDataAndType(startDir, "vnd.android.cursor.dir/lysesoft.andexplorer.directory");
And setup title and colors:
intent.putExtra("explorer_title", "Select Folder...");
intent.putExtra("browser_list_background_color", "66000000");
And start the Activity:
startActivityForResult(intent, OPEN_FOLDER_REQUEST);
Selected folder will be returned in onActivityResult method:
Uri selectFile = intent.getData();
|
|
Uncompress archive:
You have to define an archive to uncompress:
Intent intent = new Intent();
intent.setAction(Intent.ACTION_VIEW);
Uri uri = Uri.fromFile(new File("/sdcard/file1.zip"));
intent.setDataAndType(uri, "application/zip");
And setup title:
intent.putExtra("archiver_title", "Uncompress into...");
And start the Activity:
startActivityForResult(intent, UNCOMPRESS_REQUEST);
Nothing returned in onActivityResult method
|
|
The following table provides all properties available for AndExplorer Intents:
Property |
Description |
Required |
Intent action |
To select a file or folder use: Intent.ACTION_PICK
To uncompress an archive use: Intent.ACTION_VIEW |
Yes |
Intent data |
Initial folder where AndExplorer will browse files and folders. |
Yes |
Intent type |
To select a file, use: "vnd.android.cursor.dir/lysesoft.andexplorer.file".
To select a folder, use: "vnd.android.cursor.dir/lysesoft.andexplorer.directory".
|
Yes |
browser_filter_extension_whitelist |
List of file extension separated with comma for fie filtering. For instance: "*.jpg,*.mp3,*.zip". |
No |
explorer_title |
Title text display in AndExplorer browser. |
No |
browser_title_background_color |
AARRGGBB value for browser title background color. For instance, "440000AA".
|
No |
browser_title_foreground_color |
AARRGGBB value for browser title foreground color. For instance, "FFFFFFFF". |
No |
browser_list_background_color |
AARRGGBB value for browser list background color. For instance, "66000000" |
No |
browser_list_fontscale |
Browser font scale. For instance, "120%".
|
No |
browser_list_layout |
Identifier that allows selecting file info displayed in browser list:
0=simple list
1 = list with filename and size
2 = list with filename, size and date. |
No |
browser_line |
Additional text field at the bottom of browser to fill in or update file/folder selected. Use "enabled" to display it. Interesting when you plan Save As... feature.
|
No |
browser_line_textfield |
Initial text in brower line textfield |
No |
|
|
Download AndExplorerClient source code |
V1.0 |
[zip] |
|
AndExplorerClient is a sample application demonstrating how to use Intents from thrid party applications. Each button triggers an Intent and returned result is displayed in a text field.
You can download source code to learn how to use such Intents. |
|
|
|
|