FileProvider - use default InternalStorage folder, filePaths ambiguity

The documentation says:

FileProvider can only generate content URIs for files you specify in advance. To specify a directory, specify the storage area and path in XML using the child elements. For example, the following path element tells the FileProvider that you intend to request the content URI 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>

      

What if I don't want to use a subdirectory but the default instorage directory?

  1. This is an example xml file from the documentation:

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

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

When I use it in my project, I get "Attribute has no Android namespace prefix"

Should I add it? Is it possible that there is an error in the documentation, or am I mistaken somewhere?

+3


source to share


1 answer


What if I don't want to use a subdirectory but the default instorage directory?

Leave the attribute path

.

When I use it in my project, I get "Attribute has no Android namespace prefix"



I have no idea what this message is giving you. If it's an IDE, it's probably a bug in the IDE. Technically, we don't even need a namespace declaration, although my sample application also has.

Should I add it?

Not. This sample app works fine without it.

+1


source







All Articles