I'm programming in Android Studio an mp3 player that reads the mp3 files from the root of the phone and shows them in a listview. My problem is that when I move through it, the app crashes and does not respond any more, having to force its closure.
could someone give me a hand?
Thank you
public ArrayList<File> EncontrarCanciones (File root)
{
ArrayList<File> songs = new ArrayList<File>();
File[]ficheros=root.listFiles();
for(File listar:ficheros)
{
if(listar.isDirectory() && !listar.isHidden())
{
songs.addAll(EncontrarCanciones(listar));
} else {
if(listar.getName().endsWith(".mp3"))
{
songs.add(listar);
}
}
}
return songs;
}