free
web stats

Copy File from Assets to Storage in Android

In this post we are going to learn how to copy a file from Assets to storage in device.

Firstly we are going to create new Android Project in Android Studio like this;

Then add new button in activity_main.xml

After then we must add uses permission to write device’s storage. We are going to add this permission in AndroidManifest.xml

Then we are going to create new directory named assets like this.

Now we create new text file, write somethings, copy and add this file in assets.( You can add any folder, image, mp4 or etc…)

Now we are going to write our codes in MainActivity.java like this;

MainActivity.java

activity_main.xml

AndroidManifest.xml

 

 

You may also like...

1 Response

  1. Baris says:

    Hi. This is copying to sd card. How can I copy to internal storage? Thanks

Leave a Reply

Your email address will not be published. Required fields are marked *