Why getExternalFilesDir return null instead of throwing exception?

388 views Asked by At

Docs say:

public File getExternalFilesDir (String type)
... Unlike Environment.getExternalStoragePublicDirectory(), the directory returned here will be automatically created for you.
Returns
Returns null if external storage is not currently mounted ...

I use this method in a library and test it on devices with maxSdkVersion="18". Before calling this method I'm sure that external storage is mounted (so, as document say, method should not return null).

Now I expect when user of library does not use WRITE_EXTERNAL_STORAGE permission, method must throw exception,because it try to create a directory and App does not use write permission, but the method returns null yet. Why this happens?

0

There are 0 answers