Skip to content
Advertisement

How to make a copy of a file in android?

In my app I want to save a copy of a certain file with a different name (which I get from user)

Do I really need to open the contents of the file and write it to another file?

What is the best way to do so?

Advertisement

Answer

To copy a file and save it to your destination path you can use the method below.

JavaScript

On API 19+ you can use Java Automatic Resource Management:

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