0

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;
}
Liftoff
  • 24,717
  • 13
  • 66
  • 119
jagcweb
  • 322
  • 1
  • 11
  • Use Logcat to examine the stack trace associated with the crash: https://stackoverflow.com/questions/23353173/unfortunately-myapp-has-stopped-how-can-i-solve-this – CommonsWare May 20 '19 at 18:50
  • but I do not have a total crash, simply the application stops responding to the touch but the song continues to sound. – jagcweb May 20 '19 at 18:58
  • "but I do not have a total crash" -- you wrote "my application crashes when I scroll in the listview". All we can do is go by what you write. You are going to need to step through your code in a debugger, or add logging statements, or otherwise attempt to determine where your problem lies. – CommonsWare May 20 '19 at 19:02

0 Answers0