Pick directory

Intents using Pick directory

Title Description
Pick directory
Action: 
org.openintents.action.PICK_DIRECTORY
Input: 
A file URI for suggested starting directory. Can also be left empty.
Output: 
File URI of the selected directory.

Pick a directory (folder) through a file manager.

Sample usage:

Intent intent = new Intent("org.openintents.action.PICK_DIRECTORY");
intent.setData(Uri.parseUri("file:///sdcard"));
intent.putExtra("org.openintents.extra.TITLE", "Please select a folder");
intent.putExtra("org.openintents.extra.BUTTON_TEXT", "Use this folder");
startActivityForResult(intent, 1);

The picked directory URI can be obtained in onActivityResult() through getData().

Details can be found in the sample application TestFileManager in the public repository.

You may want to use the OI File Manager intent definition file.

Status of intents protocol: 

Comments

Hi Peli,

Where is this org.openintents.action.PICK_DIRECTORY intent is written??

It is just a string that you can define and use as the action. You can also copy the FileManagerIntents class from the OI File Manager source code into your application and use the static String constants defined there.

Peli,
First of sorry to post comment of the PICK_FILE here due to no comment option is available in the PICK_FILE section.

To open a file stored in the sdcard i used following code,

first I have added follwing ACTION string variable,
public static final String ACTION_PICK_FILE = "org.openintents.action.PICK_FILE";

then I used follwing code in the onclick() function

Intent myIntent = new Intent(ACTION_PICK_FILE,Uri.parse("file://"+ file.getAbsolutePath()));
startActivity(myIntent);

but it shows error in opening file.

I also added follwing in the manifest.xml.

but still no improvemnet in the result.
Please help. Thanks in advance.

Please move this detail question to the developer forum. Write in detail what the error message is (is it a toast, or is it in logcat?). Have you tried the TestFileManager sample application? Does that work for you? Please reply in the developer forum.