Saf - Nullpointerexception When Copying File From Private App Folder To Authorized Saf Folder
My app has to copy a file from private app folder to a SAF folder with the suitable permissions granted. The used code is: static boolean copyFileToTargetFolderWithNewName(Activity
Solution 1:
You are trying to copy a non-document Uri (contentUri), and the JavaDocs for copyDocument() state that the first parameter needs to be a document Uri:
document with Document#FLAG_SUPPORTS_COPY This value must never be null.
When DocumentsContract refers to a Uri as a "document", it means a Uri obtained through DocumentsContract itself. That would include a Uri obtained through ACTION_OPEN_DOCUMENT or a Uri obtained through a tree DocumentFile. However, that will not cover:
- A
Uricreated byUri.fromFile() - A
UrifromFileProvider.getUriForFile() - A
Uricreated byUri.parse()from anhttporhttpsURL - Etc.
Post a Comment for "Saf - Nullpointerexception When Copying File From Private App Folder To Authorized Saf Folder"