Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save serhiitereshchenko/5949a05179d04f93692f96742d583cf5 to your computer and use it in GitHub Desktop.
Save serhiitereshchenko/5949a05179d04f93692f96742d583cf5 to your computer and use it in GitHub Desktop.
if (BuildConfig.VERSION_CODE > Build.VERSION_CODES.KITKAT) {
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
startActivityForResult(intent, FILE_CODE);
} else {
Intent i = new Intent(getActivity(), FilePickerActivity.class);
i.putExtra(FilePickerActivity.EXTRA_ALLOW_MULTIPLE, false);
i.putExtra(FilePickerActivity.EXTRA_ALLOW_CREATE_DIR, false);
i.putExtra(FilePickerActivity.EXTRA_MODE, FilePickerActivity.MODE_DIR);
i.putExtra(FilePickerActivity.EXTRA_START_PATH, Environment.getExternalStorageDirectory().getPath());
startActivityForResult(i, FILE_CODE);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment