Android examples for File Input Output:Directory
traverse Dir and return a list of file
//package com.java2s; import java.io.File; import java.util.LinkedList; public class Main { public static LinkedList<File> traverseDir(String dirPath) { LinkedList<File> files = new LinkedList<File>(); File dir = new File(dirPath); File[] file = dir.listFiles(); for (File aFile : file) { if (aFile.isDirectory()) { files.add(aFile);/*w ww . j av a 2 s .c o m*/ } } for (File aFile : files) { files.removeFirst(); if (aFile.isDirectory()) { file = aFile.listFiles(); for (File tFile : file) { files.add(tFile); } } } return files; } }