you can try this FileContains = new File(PathName); File[] Filenames = FileContains.listFiles( new FilenameFilter() {
public boolean accept(File FileContains, String name) { return name.endsWith(".mp3") || name.endsWith(".MP3"); } }); Payal Hi mark, thanks, but i am trying that java.io.file but its giving whatever files in the SDcard whether it could be .txt etc. but i need only mp3 files list so if u have any idea than let ne know.. my code is loke this private File FileContains; FileContains = new File(PathName); if(FileContains.isDirectory()){ Filenames = FileContains.listFiles(); NoOfFiles = Array.getLength(Filenames); } so from the above code it will give all the files list but i need only mp3 files so if u have any idea then let me know Thanks Rakesh > > > On Sep 10, 5:20 pm, Mark Murphy <[EMAIL PROTECTED]> wrote: > > patelpower wrote: > > > Hello everyone, > > > > > i want to read the mp3 files only from the sdcard so is there any API > > > so it could read only mp3 files and give the list of the files indise > > > the SDcard > > > > Look in the java.io package. You probably want File#listFiles(), perhaps > > one of the flavors that takes a filter parameter. > > > > -- > > Mark Murphy (a Commons Guy)http://commonsware.com > > _The Busy Coder's Guide to Android Development_ Version 1.2 Published! > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Android Beginners" group. To post to this group, send email to android-beginners@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/android-beginners?hl=en -~----------~----~----~----~------~----~------~--~---