Android Directory Content Get listFiles(File dir)

Here you can find the source of listFiles(File dir)

Description

list Files

Declaration

public static List<File> listFiles(File dir) 

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> listFiles(File dir) {
        List<File> list = new ArrayList<File>();
        if (dir.exists()) {
            for (File f : dir.listFiles()) {
                if (f.isFile()) {
                    list.add(f);/* w  w w  . j av a2  s.com*/
                }
            }
        }

        return list;
    }
}

Related

  1. getFiles(File parentDir)
  2. getFilesAndSubFolderFiles(List fileList, File rootDir)
  3. listDirs(File file)
  4. listDirs(String fileName)
  5. listFile(File dir)
  6. listFiles(File rootDir, final String... sufix)
  7. getFileList(String path)
  8. listFilesByDirectory(String directoryPath, boolean isOnlyFile)
  9. listFiles(final String directory, final boolean root)