2011年7月7日木曜日

ファイル検索用

ファイル検索用:

public void searchFile(String path) {
String paths = path + "/";
File file = new File(paths);
File[] filelist = file.listFiles();
if (filelist != null) {
 for (int i = 0; i < filelist.length; i++) {
   if (filelist != null) {
   File g = new File(filelist[i].getPath());
   if (g.isDirectory()) {
    TraversalFile(g.getPath());

   } else if (g.getName().endsWith(".mp3")) {
    mSongs.add(g.getName());
   mSongspath.add(g.getPath());

   }else if (g.getName().endsWith(".mp4")) {
   mvideos.add(g.getName());
   mvideopaths.add(g.getPath());
   }
  }
}
}

}

0 件のコメント: