Android Directory Content Get getFiles(File parentDir)

Here you can find the source of getFiles(File parentDir)

Description

get Files

Declaration

public static List<File> getFiles(File parentDir) 

Method Source Code

//package com.java2s;
import java.io.File;

import java.util.ArrayList;
import java.util.List;

public class Main {
    public static List<File> getFiles(File parentDir) {
        List<File> fileList = new ArrayList<>();
        File[] files = parentDir.listFiles();
        if (files != null) {
            for (File file : files) {
                if (file.isFile()) {
                    fileList.add(file);// w  w w.  j  a va  2s. c om
                }
            }
        }
        return fileList;
    }
}

Related

  1. getFileInDirectory(File f)
  2. getFilesAndSubFolderFiles(List fileList, File rootDir)
  3. listDirs(File file)
  4. listDirs(String fileName)
  5. listFile(File dir)