Example code of mutual conversion between Android URI and file path

In the project, you need to convert URI into absolute path, find a method on the Internet and take notes

There are many methods on the Internet, but some are invalid for versions after 4.4. The methods here can convert URI to absolute path in versions after 4.4

Absolute path to URI is relatively simple

Create an File object with an absolute path, and then call it.

Uri.fromFile(file)

The above is the example code of Android URI and file path conversion introduced by Xiaobian. I hope it will help you. If you have any questions, please leave me a message and Xiaobian will reply to you in time. Thank you very much for your support for the programming tips website!

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>