【发布时间】:2017-02-27 13:58:51
【问题描述】:
处理从外部存储中选择文件的任务。 这里我的文件选择器显示云选择选项也像 Google Drive 和 Drop-Box,如果它相应的云应用程序在设备中可用,也会显示。 如何避免文件选择器显示云选择选项,即使它在设备中可用。
上图显示了 Google Drive 和 Drop-Box。如何避免这些云选项?以及如何创建仅选择选项设备存储的文件选择器。
我在这里编写显示文件选择器对话框的代码。
private void showFileChooser1() {
Intent intent = new Intent(Intent.ACTION_GET_CONTENT);
intent.setType("*/*");
intent.addCategory(Intent.CATEGORY_OPENABLE);
Log.e("2", "2");
try {
Log.e("intent","intent"+intent.getType());
startActivityForResult(
Intent.createChooser(intent, "Select a File to Upload"),
FILE_SELECT_CODE);
} catch (android.content.ActivityNotFoundException ex) {
}
}
【问题讨论】:
-
使用自定义文件选择器
-
您能否分享任何链接或代码。我搜索了自定义文件选择器,但没有得到解决方案。你能帮我找到解决办法吗?
-
有一件事,这些显示在您的手机中,而不是每部手机。由于您从那里打开了一些文件,因此它会显示有人安装您的应用时的一些最近历史记录,它与您的图片不同。
-
它是一个简单的文件选择器对话框示例Creating Custom File Explorer Dialog In Android
标签: android android-dialog android-file filechooser android-fileprovider