How to get absolute paths in the removable SD-card

2019-07-12 20:15发布

问题:

Is there any way to get the absolute path from specific Folders & Files located in the removable SD-card, using the Storage Access Framework (SAF)?

Thanks

回答1:

No, and even if you could, you would not be able to access them, unless they happened to be in one of the couple of locations on removable media for which you have read access (e.g., getExternalFilesDirs()).

The Storage Access Framework returns Uri values pointing to documents. Use ContentResolver and methods like openInputStream() to work with them. This is roughly equivalent to getting URL values pointing to documents and using an HTTP client to open a stream to work with the contents of those documents.