hedzr / android-file-chooser

a lightweight file/folder chooser or picker
Apache License 2.0
284 stars 62 forks source link

Cannot create directory on external SDCard #43

Closed ghost closed 5 years ago

ghost commented 5 years ago

When the dialog opens, I go the actual external SDCard and try to create a new directory but it fails with this error: https://github.com/hedzr/android-file-chooser/blob/9bcf7890aa000930ddccaf5a9d17e6b86fa16a25/library/src/main/java/com/obsez/android/lib/filechooser/ChooserDialog.java#L1174

If I go the external card provided by Environment.getExternalStorageDirectory(), I can create a new folder. This happens on Android 8.0 (targetSdkVersion 28). From what I read on some forums, Android 5.0+ must use a new API (https://developer.android.com/guide/topics/providers/document-provider#client) in order to access external cards. Is this implemented in this library?

hedzr commented 5 years ago

we use standard android/java apis. so hardware errors, file/folder permissions and many others may infect the action of creating a new folder. i'm not sure the new api you said, photo/image picker? if it is, not yet. Or, accessing android virtual directories such as Pictures?

Guiorgy commented 5 years ago

First of all, it's API 19 and above (4.4.4). And, though SAF sounds great, there are a few points to remember. Saf operates with URIs rather than Files, which allows it to seek content not only locally, but also on a cloud drive for example. But, let's say we did use SAF. Would you be able to use a given URI to do what you were doing with a Java.io.File? Because remember, you can't really get a File from a URI! Also, the SAF provides a standard interface, meaning that whenever you use SAF, you will be prety much stuck with this activity. No more dialogs. Whether thats good or not, that will be left to personal preferences. And I am prety sure moving to SAF is not really posible. We would have to completely scratch this project and start anew?

ghost commented 5 years ago

I understand, thanks