3

Possible Duplicate:
Android: How to copy files in 'assets' to sdcard?

Is there any way to copy the content of the asset folder with all the directories, subdirectories, and files to the sdcard?

Community
  • 1
  • 1
biquillo
  • 6,469
  • 7
  • 37
  • 40
  • There shouldn't way to copy asset folder w/sub dirs, at least not everything can be copied. Android would compress/pre-process some types of content and I really doubt if they were kept in their original form. For example, strings would be compiled, some layouts (menus) may processed in a way not in xml format. They simply, not present in the final apk file. – xandy Feb 12 '11 at 00:18
  • xandy I am not talking about the res folder, I meant the assets which is untouched by the android system – biquillo Feb 12 '11 at 01:14

1 Answers1

5

Pretty much, just use standard java I/O. However, you pretty much have to know your asset contents ahead of time and code to them, as the list() method on AssetManager is not terribly sophisticated.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • I was trying to use Apache FileUtils, it has some handy methods to copy full directories, but I cannot make it work with the assets. – biquillo Feb 12 '11 at 03:49
  • @biquillo: I really doubt Apache FileUtils will help you here. – CommonsWare Feb 12 '11 at 12:04
  • 1
    ok got it :) I think the best solution for copying lots of files such in my case is to zip everything put it in the assets folder and then uncompress it to the sdcard :) thanks anyway :) – biquillo Feb 12 '11 at 18:27