Android: Open file with intent chooser from URI obtained by Storage Access Framework

前端 未结 2 2064
难免孤独
难免孤独 2020-12-16 14:26

In the beginning the user can select files with the new Storage Access Framework (Assuming the app is API>19):

https://developer.android.com/guide/topics/providers/d

2条回答
  •  [愿得一人]
    2020-12-16 14:38

    Well the solution has already been provided on the SO and you only needed to search for it.

    This is the answer by Paul Burke. He has written a utility class which returns complete file path for such a content path.

    He says:

    This will get the file path from the MediaProvider, DownloadsProvider, and ExternalStorageProvider, while falling back to the unofficial ContentProvider method you mention.

    and

    These are taken from my open source library, aFileChooser.

    FileUtils.java is the place where Paul Burke has written the method you're looking for.

提交回复
热议问题