0

I want save a folder with some sub folders and files in mnt->sdcard on emulator from DDMS.I can save files one after other but I cant save many files at a time or cant save a folder totally in sdcard because I am new by android.I did some searches but can not doing my job yet.what do i do?

sarah
  • 125
  • 3
  • 12

1 Answers1

0

maybe this?

File root = new File(Environment
              .getExternalStorageDirectory()+"/myPrivateFolder");
if(!root.exists()){
        root.mkdir();
}
else{
    File[] files = root.listFiles(); //access your files
}
File myFile = new File(Environment
              .getExternalStorageDirectory()+"/myPrivateFolder/myFile.txt");
myFile.createNewFile();  // creating file

don ever hardcoe "/sdcard" or smth like this. for more convenient method of navigation each File has methods for accessing abosulutePath, getting info about is file or folder or even exists and other

snachmsm
  • 17,866
  • 3
  • 32
  • 74