public static File[] getDownloadDirs(String subDir) {
Context context = XposedApp.getInstance();
ArrayList<File> dirs = new ArrayList<>(2);
for (File dir : ContextCompat.getExternalCacheDirs(context)) {
if (dir != null && EnvironmentCompat.getStorageState(dir).equals(Environment.MEDIA_MOUNTED)) {
dirs.add(new File(new File(dir, "downloads"), subDir));
}
}
dirs.add(new File(new File(context.getCacheDir(), "downloads"), subDir));
return dirs.toArray(new File[dirs.size()]);
}
return dirs.toArray(new File[dirs.size()])
这里的toArray() 这个里面new File 怎么是一个中括号呢?有人知道吗?
[]代表数组,[数组大小]