Hi every one,
I am trying to show the .kar files and .mid files which are located in
the sdcard.
For that I have written the code like:
class MyFileFilter implements FileFilter
{
public boolean accept(File pathname)
{
if (pathname.getName().endsWith(".mid")) // audio
return true;
if (pathname.getName().endsWith(".kar")) // audio
return true;
return false;
}
}
public void listAllMediaFiles(String path)
{
File cwd = new File(path);
File[] myFiles = cwd.listFiles(new MyFileFilter());
for (int i = 0; i < myFiles.length; i++)
{
String mediaFileName = myFiles[i].getName();
mediaFilesVctr.add(mediaFileName);
mediaFilesLocVctr.add(myFiles[i].getPath());
}
File []allFiles = cwd.listFiles();
for(int len = 0;len<allFiles.length;len++)
{
//System.out.println(allFiles[len]);
if(allFiles[len].isDirectory())
{
listAllMediaFiles(allFiles[len].getPath());
}
}
}
and I am calling listAllMediaFiles("/sdcard");
it lists all the files including some temp files also.
How can I eliminate showing the temp files?
Thanks,
Manoj.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---