Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Some tests showed me that the default directory where Android stores files created by an application using <code>Context.getFilesDir()</code> is <code>/data/data/&lt;your_package_name&gt;/files</code></p> <p>To count the files in any given directory you use <code>File.listFiles(FileFilter)</code> over the root dir. Your FileFilter should then be something like this (to filter for ".rbc" files):</p> <pre><code>public static class RBCFileFilter implements FileFilter { @Override public boolean accept(File pathname) { String suffix = ".rbc"; if( pathname.getName().toLowerCase().endsWith(suffix) ) { return true; } return false; } } </code></pre> <p>If you have some kind of directory structure you need to recursively search then you will have to <code>File.listFiles(FileFilter)</code> over the entire directory structure. And it should be something like:</p> <pre><code>public static List&lt;File&gt; listFiles(File rootDir, FileFilter filter, boolean recursive) { List&lt;File&gt; result = new ArrayList&lt;File&gt;(); if( !rootDir.exists() || !rootDir.isDirectory() ) return result; //Add all files that comply with the given filter File[] files = rootDir.listFiles(filter); for( File f : files) { if( !result.contains(f) ) result.add(f); } //Recurse through all available dirs if we are scanning recursively if( recursive ) { File[] dirs = rootDir.listFiles(new DirFilter()); for( File f : dirs ) { if( f.canRead() ) { result.addAll(listFiles(f, filter, recursive)); } } } return result; } </code></pre> <p>And where <code>DirFilter</code> would implements <code>FileFilter</code> this way:</p> <pre><code>public static class DirFilter implements FileFilter { @Override public boolean accept(File pathname) { if( pathname.isDirectory() ) return true; return false; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload