i want to get the path of file like pdf, txt, etc. so I used this "how to get the file path of a file?" code from StackOverflow but this code is working with API level-22 and below but my project need is API-26.
Asked
Active
Viewed 29 times
-2
-
you need to add run time permission for that beacuse **Beginning in Android 6.0 (API level 23), users grant permissions to apps while the app is running, not when they install the app.** [read more from docs](https://developer.android.com/training/permissions/requesting.html) – AskNilesh Sep 13 '17 at 10:28
1 Answers
0
There is no path, because there is no file. ACTION_GET_CONTENT
does not have much to do with files.
If you absolutely need a file and absolutely need a path, do not use ACTION_GET_CONTENT
. Instead, use a library and embed a file picker in your app.

CommonsWare
- 986,068
- 189
- 2,389
- 2,491