How to use intent for choosing file browser to select file
this will open the build-in file explorer if available, otherwise will ask u to select a file explorer that u have installed.
private void showFileChooser() {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
//intent.setType("*/*"); //all files
intent.setType("text/xml"); //XML file only
intent.addCategory(Intent.CATEGORY_OPENABLE);
try {
startActivityForResult(Intent.createChooser(intent, "Select a File to Upload"), FILE_SELECT_CODE);
} catch (android.content.ActivityNotFoundException ex) {
// Potentially direct the user to the Market with a Dialog
Toast.makeText(this, "Please install a File Manager.", Toast.LENGTH_SHORT).show();
}
}
It may help you to choose a doc file and u may change action as per your need
Intent intent;
if (VERSION.SDK_INT >= 19) {
intent = new Intent("android.intent.action.OPEN_DOCUMENT");
intent.setType("*/*");
} else {
PackageManager packageManager =getActivity().getPackageManager();
intent = new Intent("android.intent.action.GET_CONTENT");
intent.setType("file*//*");
if (packageManager.queryIntentActivities(intent,MEDIA_TYPE_IMAGE).size() == 0) {
UserToast.show(getActivity(), getResources().getString(R.string.no_file_manager_present));
}
}
if (getActivity().getPackageManager().resolveActivity(intent, NativeProtocol.MESSAGE_GET_ACCESS_TOKEN_REQUEST) != null) {
startActivityForResult(intent, UPLOAD_FILE);
}
You can use something like this:
....
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("file/*");
startActivityForResult(intent, YOUR_RESULT_CODE);
....
But I really doubt that you can set a filter third-party file browsers. Or you can try to use this file dialog: http://code.google.com/p/android-file-dialog/