0

Im trying to create a simple application which will copy a file from "assets" folder of the APK Package to (e.g. mnt/sdcard/android/data/com.testdev.testapp when button1 get clicked.

But i don't know how to do this. Is this even Possible or are there any workarounds?

Could anyone help me?

Thanks in advance

Rajat
  • 47
  • 2
  • 9

1 Answers1

1

Step #1: Call getAssets() on any Context (e.g., your Activity) to get an AssetManager.

Step #2: Call open() on the AssetManager to get an InputStream on your desired asset.

Step #3: Use standard Java file I/O to copy from that InputStream to a FileOutputStream pointing at a spot on external storage.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491