2013-09-04 1 views
-1

특정 폴더의 모든 파일을 가져오고 싶습니다. 누구든지 관리 쿼리를 사용하여 특정 폴더의 모든 파일을 쿼리하는 방법을 제안 해 줄 수 있습니까?android에서 특정 폴더의 모든 파일을 선택하려면 어떻게 쿼리합니까?

+0

를 시도? 파일이 필요한 이유는 무엇입니까? 파일 목록이 필요합니까? 귀하의 질문을 명확히하십시오. –

+0

폴더 또는 모든 파일의 모든 파일 이름을 원하십니까? 질문이 혼란 스럽습니다. 개발 한 코드가 있으면 알려주십시오. –

답변

2

당신이 뭘 하려는지 이런 식으로

ArrayList<File> mFiles = new ArrayList<File>(); 
      File mDirectory; 
     String folderPath = "/mnt/sdcard/download"; 
     mDirectory = new File(folderPath); 
     ExtensionFilenameFilter filter = new ExtensionFilenameFilter(acceptedFileExtensions); 

      // Get the files in the directory 
      File[] files = mDirectory.listFiles(filter); 
      if (files != null && files.length > 0) { 
       for (File f : files) { 

        mFiles.add(f); 
       } 

       Collections.sort(mFiles, new FileComparator()); 
      } 
관련 문제