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;
    }

猜你喜欢

转载自blog.csdn.net/qq_35605213/article/details/81103249
今日推荐