gpt4 book ai didi

android - FileProvider - 使用默认的内部存储文件夹,文件路径不明确

转载 作者:太空狗 更新时间:2023-10-29 14:08:33 25 4
gpt4 key购买 nike

文档中说:

A FileProvider can only generate a content URI for files in directories that you specify beforehand. To specify a directory, specify the its storage area and path in XML, using child elements of the element. For example, the following paths element tells FileProvider that you intend to request content URIs for the images/ subdirectory of your private file area.

 <paths xmlns:android="http://schemas.android.com/apk/res/android">
<files-path name="my_images" path="images/"/>
... </paths>

如果我不想使用子目录,而是使用默认的内部存储目录怎么办?

  1. 这是来自文档的示例文件路径 xml 文件:

    < 路径 xmlns:android="http://schemas.android.com/apk/res/android">

    <files-path name="my_images" path="images/"/>

    <files-path name="my_docs" path="docs/"/>

当我在我的项目中使用它时,我得到“属性缺少 Android 命名空间前缀”

我应该添加它吗?文档是否有可能有错误,或者我在某处犯了错误?

最佳答案

What If I dont want to use a subdirectory, but the default internalstorage directory?

离开 path 属性。

When I use it in my project, I get "Attribute is missing the Android namespace prefix"

我不知道是什么给了你这条信息。如果是IDE,那很可能是IDE的bug。从技术上讲,我们甚至不需要命名空间声明,尽管 my sample app也有。

Should I add it?

没有。 This sample app没有它也能正常工作。

关于android - FileProvider - 使用默认的内部存储文件夹,文件路径不明确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30892124/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com