In Android, assuming that I have files in "/data/data/package.name/", without knowing the names or how many files exist, what is the best way to retrieve/iterate them all? Also, the name is numerical only.
            Asked
            
        
        
            Active
            
        
            Viewed 130 times
        
    1 Answers
1
            It looks like you want to list all of the files in the directory, and (possibly) recurse if a file is a directory.
You can find how to do this at the answer to this question.
Copy-pasted:
File f = new File("/data/data/package.name/");
File[] files = f.listFiles();
for (File inFile : files) {
    if (inFile.isDirectory()) {
        // is directory; recurse?
    } else {
        doLogicFor(inFile);
    }
}
- 
                    Thank you! Some times when I read the documentation, I don't really understand its usage. I guess this is one of the cases. – drum Apr 03 '12 at 02:24