更新时间:2023-11-26 17:33:22
A Uri
is not necessarily a File
. The code that you are using to try to get a File
for a Uri
was never reliable and will not work much going forward.
请使用ContentResolver
和类似openInputStream()
和getType()
的方法适当地使用Uri
.本质上,您使用Uri
的方式与访问Web服务器的URL的方式相同,并且出于相同的原因:ContentProvider
浮出水面的内容不需要来自普通的
Please consume the Uri
appropriately, using a ContentResolver
and methods like openInputStream()
and getType()
. In essence, you treat a Uri
the same way that you would a URL to a Web server, and for much the same reason: there is no requirement for the content surfaced by a ContentProvider
to be coming from an ordinary File
that your app can access.