Skip to content
Advertisement

How to save Tempfile to External storage using ACTION_OPEN_DOCUMENT_TREE?

unable to save the zip file to external storage after picking a folder using ACTION_OPEN_DOCUMENT_TREE.

I’m creating a project which creates and manipulate files and document, in that task I want to save that stuff in external storage but I can’t do that with android developer documentation, so please explain additionally.

I want to save this file

JavaScript

to

JavaScript

what should I do?

here is my code,

– code for picking a directory to save a file into.

JavaScript

– Code to be executed after selecting a directory,

JavaScript

method saveFile

JavaScript

Advertisement

Answer

So Asking for a file instead of directory to be nicer to the user and lessen overwriting issues.

JavaScript

Note for initial start directory see How I set the ACTION_OPEN_DOCUMENT_TREE start path the first time a user uses my app?

Also note that in your “saveFile” method

JavaScript

could be replaced with

JavaScript

As you say that this file is in your Apps private Cache directory, so won’t have any permissions problems.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement