Welcome. I'm new to the forum.


I need to delete the contents of the folder that is located directly on the SD card. The folder is called "dousuniecia"
I use Eclipse with ADT

I need to delete the contents of the folder located on a sd card.
I found this code:

Java Code:
File file = new File (sdCard.getAbsolutePath () + "dousuniecia");
     String [] myFiles;

      myFiles = file.list ();
      for (int i = 0; i <myFiles.length, i + +) {
          File myFile = new File (file, myFiles [i]);
          myFile.delete ();
      }
My questions:
1) Is it better to use:
File file = new File (sdCard.getAbsolutePath () + "dousuniecia");
or
File file = new File ("sdcard / dousuniecia");
or
File file = new File ("sdcard / / dousuniecia");

2) Does it work? What do I need to improve?
3) What I need to import library for this code?
4) I know that I need to add permission to "AndroidManifest":
<uses-permission android:name="android.permission.WRITE_EXTERNAL_ST ORAGE" />

Anything else I need to do?