Okay here we go....
(if you dont yet look this activity please look unto it and that is recommended)
Okay, see i put this code in SongsManager.java
/**
* Class to filter files which are having .mp3 extension
* */
//you can choose the filter for me i put .mp3
class FileExtensionFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
return (name.endsWith(".mp3" ) || name.endsWith(".MP3" )) ;
}
}
then the technique is you will add another code or syntax into the code, like this:
/**
* Class to filter files which are having .mp3 extension
* */
//you can choose the filter for me i put .mp3
class FileExtensionFilter implements FilenameFilter {
public boolean accept(File dir, String name) {
return (name.endsWith(".mp3" ) || name.endsWith(".apk" )) || name.endsWith(".3gp" ) ;
}
}
Now don't forget about the path we did in previous activity:public class SongsManager {
// SDCard Path
//choose your path for me i choose sdcard
final String MEDIA_PATH = new String("/sdcard/");
private ArrayList> songsList = new ArrayList>();
// Constructor
public SongsManager(){
}
you see now if you run it on your real device you can see more than one extensions appearing in listview..Hope i help you out your problem..
thanks,
Regards,
Doni.
You may also like this post :