1. 程式人生 > >Android獲取資料夾下的所有子檔名稱;

Android獲取資料夾下的所有子檔名稱;

  public static List<String> getFilesAllName(String path) {
        File file=new File(path);
        File[] files=file.listFiles();
        if (files == null){Log.e("error","空目錄");return null;}
        List<String> s = new ArrayList<>();
        for(int i =0;i<files.length;i++){
            s.add(files[i].getAbsolutePath());
        }
        return s;
    }