accéder à android répertoire de médias?

ey en place. ive a construit une musique simple application qui lit les fichiers wav à partir de la carte sd et de les joue.
comment puis-je accéder au répertoire de données par défaut?
c'est la façon dont je reçois la carte sd

public void LoadSounds() throws IOException
    {
        String extState = Environment.getExternalStorageState();

         if(!extState.equals(Environment.MEDIA_MOUNTED)) {
             //handle error here
         }
         else {

         File sd = new File(Environment.getExternalStorageDirectory ()); //this needs to be a folder the user can access, like media

comme d'habitude, les docs ne pas donner un exemple d'utilisation, mais il dit ce - Si vous utilisez l'API de Niveau 8 ou plus, utilisez getExternalFilesDir() pour ouvrir un Fichier qui représente le stockage externe répertoire où vous pouvez enregistrer vos fichiers. Cette méthode prend un paramètre de type spécifie le type de sous-répertoire que vous voulez, comme DIRECTORY_MUSIC...

comment puis-je l'utiliser?
merci

edit:
de ce fait, il crash si j'essaie de remplir un spinner tableau avec chemin d'accès au fichier de Chaînes.

File path = getExternalFilesDir(Environment.DIRECTORY_MUSIC);
            File sd = new File(path, "/myFolder");

File[] sdDirList = sd.listFiles(new WavFilter()); 
         if (sdDirList != null)
         {   
             //sort the spinner 
            amountofiles = sdDirList.length;


             array_spinner=new String[amountofiles];
......
final Spinner s = (Spinner) findViewById(R.id.spinner1); //crashes here

        ArrayAdapter<?> adapter = new ArrayAdapter<Object>(this,
        android.R.layout.select_dialog_item, array_spinner);

EDIT2:
ok, donc nous avons fait ce test qui est censé écrire un fichier txt du répertoire de musique.
je lance l'application, pas de fichier txt est écrit nulle part sur l'appareil que je peux trouver.

 //Path to write files to
        String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC).getAbsolutePath();

        String fname = "mytest.txt";

        //Current state of the external media
        String extState = Environment.getExternalStorageState();

        //External media can be written onto
        if (extState.equals(Environment.MEDIA_MOUNTED))
        {
            try {
                //Make sure the path exists
                boolean exists = (new File(path)).exists();  
                if (!exists){ new File(path).mkdirs(); }  

                //Open output stream
                FileOutputStream fOut = new FileOutputStream(path + fname);

                fOut.write("Test".getBytes());

                //Close output stream
                fOut.flush();
                fOut.close();

            } catch (IOException ioe) {
                ioe.printStackTrace();
            }



    }

un autre edit: je vais le faire fonctionner!!
donc, si j'utilise cette ligne crée un dossier sur la carte sd appelé "Musictest'. ne comprends pas??

 String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC + "test").getAbsolutePath();

////////////////////////////////////////////////////////////////////
Montage Final:
droit donc ce sera pour un dossier nommé test dans les dispositifs de répertoire de musique.
si elle n'existe pas, il sera créé.
(certains de fixation à faire ici, d'erreur si vide) il énumère ensuite les fichiers dans le répertoire et de les ajouter à un tableau.

 public void LoadSounds() throws IOException
    {
        String extState = Environment.getExternalStorageState();
        //Path to write files to
            String path = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_MUSIC + "/test").getAbsolutePath();

         if(!extState.equals(Environment.MEDIA_MOUNTED)) {
             //handle error here
         }
         else {
             //do your file work here 

                //Make sure the path exists
                boolean exists = (new File(path)).exists(); 
                //if not create it
                if (!exists){ new File(path).mkdirs(); }


         File sd = new File(path);
         //This will return an array with all the Files (directories and files)
         //in the external storage folder

         File[] sdDirList = sd.listFiles(); 

         if (sdDirList != null)
         {   
             //add the files to the spinner array
             array_spinnerLoad=new String[sdDirList.length];
             files = new String[sdDirList.length];

         for(int i=0;i<sdDirList.length;i++){

         array_spinnerLoad[i] = sdDirList[i].getName();
        files[i] = sdDirList[i].getAbsolutePath();
         }

         }
         }
    }
InformationsquelleAutor user1033558 | 2011-11-25