【发布时间】:2021-10-10 05:04:36
【问题描述】:
注意:所有类型的文件
我使用默认的 Gallery Intent 来显示存储,但它显示了 Goggle Drive 选项以及本地存储 我尝试了以下推荐,但对我没有任何作用。
参考:
- How to let user select only local files using Intent in Android? 2 .https://stackoverflow.com/questions/27762377/android-why-intent-extra-local-only-shows-google-photos
- Is it possible to hide google drive while using Intent.ACTION_GET_CONTENT in android?
使用另一个库,显示唯一的本地存储,它工作正常 但要求是,只需要显示本地存储及其所有文件类型以及文件大小,这在此库中不可用。 请建议其他一些类似下面显示文件大小的库
参考: https://github.com/codekidX/storage-chooser https://androidexample365.com/lets-user-choose-files-in-internal-or-external-storage-with-just-few-lines-of-code/
【问题讨论】:
-
default Gallery Intent?没听说过。你认为那是什么? -
意图意图 = new Intent();意图.setType("/");意图.setAction(意图.ACTION_GET_CONTENT); intent.putExtra("android.content.extra.SHOW_ADVANCED", true); intent.putExtra(Intent.EXTRA_LOCAL_ONLY, true); startActivityForResult(Intent.createChooser(intent, "选择文件"), 10);我使用上面的代码作为默认意图
标签: android