比如,我要搜索位于sdcard里的所有的.mp3文件,或者.lrc ,.txt等。应该怎么去实现???多谢!回答正确 追加50分~~

解决方案 »

  1.   

    File f = new File("/your/file/path"); 
    File[] files = f.listFiles(); 
      

  2.   

     private List<String> lists;
        private void GetFileList(String strPath){
         File file = new File(strPath);
         file.listFiles(new FileFilter() {
    @Override
    public boolean accept(File f) {
    // TODO Auto-generated method stub
    if(isMp3File(f.getPath()))
    lists.add(f.getPath());
    else if(f.isDirectory()){
    GetFileList(f.getPath());
    }
    return false;
    }
    });
        }
       private boolean isMp3File(String strPath){
       String strExtend = strPath.substring(strPath.lastIndexOf(".")+1, strPath.length()).toLowerCase();
       if(strExtend.equals("mp3"))
       return true;
       return false;
       }试试吧!