I am making a mp3 app for a class project. It's supposed to read the path of every mp3 file in an sd card and put them in a list, but it crashes every time I attempt to access it.I tried to display a element using textview after five seconds, and it crashed again, so I know the problem is in the list.
Help? Thank you! P.S - Yes, there are mp3 files in the directory.
class mpfilter implements FilenameFilter {
public boolean accept(File dir, String name) {
    return(name.endsWith(".mp3"));
}
void update() {{
    File home= new File(path);
    if(home.listFiles(new mpfilter()).length>0) {
         for( File file: home.listFiles( new mpfilter())) {
             songs.add(file.getName());
         }
    }}
}
     Mp= new MediaPlayer();
     path= new String("/Card/music/");
     songs= new ArrayList<String>();
    Play.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            // TODO Auto-generated method stub
            Mp.reset();
            Mp.setDataSource(path+songs.get(x));
            Mp.prepare();
            Mp.start();
        }
