Android Directory Content Get getFileList(String path)

Here you can find the source of getFileList(String path)

Description

get File List

Declaration

public static ArrayList<String> getFileList(String path) 

Method Source Code

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

public class Main {

    public static ArrayList<String> getFileList(String path) {
        ArrayList<String> fileList = new ArrayList<String>();
        File dir = new File(path);
        File[] files = dir.listFiles();
        if (files == null)
            return null;
        for (int i = 0; i < files.length; i++) {
            if (files[i].isDirectory()) {
                getFileList(files[i].getAbsolutePath());
            } else {
                String fileName = files[i].getAbsolutePath().toLowerCase();
                fileList.add(fileName);/*  www  .j a  va  2  s  . co m*/
            }
        }
        return fileList;
    }
}

Related

  1. listDirs(File file)
  2. listDirs(String fileName)
  3. listFile(File dir)
  4. listFiles(File dir)
  5. listFiles(File rootDir, final String... sufix)
  6. listFilesByDirectory(String directoryPath, boolean isOnlyFile)
  7. listFiles(final String directory, final boolean root)