Похожие чаты

How can I get file path/uri in kotlin? Android studio

7 ответов

23 просмотра

At the first step, it depends on the android version of the system which the app is running in. As far as I know , from the api level 28 , a subject is introduced that is "Scoped storage". Since then , the way of accessing the external storage changed. There are several documents in google written about this. My personal opinion is to read them to get the whole information about it

Gallant- Автор вопроса
-
At the first step, it depends on the android versi...

I've checked many of dem isn't working for me I'm tryna upload the file to php with retrofit multipart but I'm not sure I'm getting the part correctly

Gallant
I've checked many of dem isn't working for me I'm ...

What do you wanna do?? You want the user to pick for example a picture so that you get the uri. You want to the the uri of some files in a special directory?? .....

Gallant- Автор вопроса
Gallant
Yes I want to get the uri

There are several alternatives for that. One of them is to use ACTION_OPEN_DOCUMENT_TREE that opens sth like a file explorer for the user then you switch to the directory you want. Then the user should press the button and agree. Then , you are able to get the uri of all the contents of that directory. Another alternative is to open the gallery and pick an image so that you have the uri of that image. (You can find the solution here) If you wanna pick another media (audio , video , download , etc ) , you can find its solution in stackoverflow and all of them are using Intent class. Another alternative is to load all the images by from the gallery by using the MediaStore class so that you have the uri of any of them. (You can do this not only with images also with music , downloads , videos). If your app is sth like a file explorer that should access the whole external storage and you wanna get the uri of each file you want , I saw the solution in the google documents but I have forgotten it.

Gallant- Автор вопроса

Похожие вопросы

Обсуждают сегодня

Какой-то там пердун в 90-х решил, что есть какая-то разная типизация. Кого вообще это волнует?
КТ315
49
Hi. Do we have a raid bot? Why nobody doing raids on X? Even RH mentioned this and nobody paying attention...whats the channel for hex memes? If mods cant run raids just insta...
H
31
Подскажите, а есть vault lite или ченить такое?) А то нужен вольт для похода в вольт, но весит он ~500 мб) как-то многовато для парочки запросов ))
Alexandr Orloff
17
блеать, почему так?? где в роутере это исправляется?
Арсен Маньяков 🇦🇲
16
void terminal_scroll() { memmove(terminal_buffer, terminal_buffer + VGA_WIDTH, buffer_size - VGA_WIDTH); memset(terminal_buffer + buffer_size - VGA_WIDTH, 0, VGA_WIDTH); ...
Егор
47
🌊 Ocean Nodes Dashboard Update 🚀 Hey, Oceaners! First off, a massive round of applause 👏to all of you for the amazing engagement since we launched Ocean Nodes. In just a few ...
KreigDK | Never DM first🌊
3
Всем привет! Подскажите, пожалуйста, в чем ошибка? Настраиваю подключение к MySQL. Либы лежат рядом с exe. Все как по "учебнику"
Евгений
16
А можете как-то проверить меня по знаниям по ассемблеру?
A A
132
Здравствуйте! У меня появилась возможность купить книгу "Изучай Haskell во имя добра!". Но я где-то слышал, что эта книга устарела. Насколько это правда??
E
22
люди, которые используют flameshot, к вам вопрос. Можно-ли поставить хоткей на создание скриншота? В программе есть отдел "горячие клавиши", но там все для редактирования, скр...
ThunDer104
11
Карта сайта