Android File.listFiles does not show all the files inside the directory
<p>I am using Android Emulator 2.2 version to develop a small application. I am supposed to list all the image files(jpg) files under a directory. I copied the files to "/data" through ADB puash command. </p>

<p>Example : /data/1.jpg</p>

<p>Now I create a File object with the directory path as input and call listFiles api.</p>

<pre><code>File dir = new File(dirPath);
File[] filelist = dir.listFiles();
</code></pre>

<p>But the fileList does not contain the image file(1.jpg).</p>

<p>But strangely, If I create a ImageView with hardcoded path "/data/1.jpg", I could see the image getting drawn.</p>

<p>Can some one help me.... where could be the problem</p>

<p>Thanks,
Kowndinya</p>

<hr>

<pre><code>public int PopulateList(final String dirPath)
{
    m_CurrentDirectory = new File(dirPath);
    _namelist.clear();
    _pathlist.clear();

    File[] fileList = m_CurrentDirectory.listFiles(imFilter);
    if (fileList != null)
    {
        for ( int i = 0;i&lt;fileList.length;i++)
        {
            _namelist.addElement(fileList[i].getName());
            _pathlist.addElement(fileList[i].getAbsolutePath()); 
        }
    }
    notifyDataSetChanged();
    return 0;
}
</code></pre>

<p>imFilter is an filenamefilter that accepts only files with jpg extension. But if I put break point in the imFilter code, break point does not event hit.</p>

<pre><code>Output of adb shell ls -l /data:
------------------------------------
drwxrwx--t system   misc              2010-08-05 15:32 misc
drwxrwx--x shell    shell             2010-08-05 15:32 local
drwxrwx--x system   system            2010-08-05 15:32 app-private
drwx------ system   system            2010-08-05 15:34 backup
drwx------ root     root              2010-08-05 15:34 property
drwxrwx--x system   system            2010-08-05 15:35 data
-rw-rw-rw- root     root        75752 2010-03-30 12:26 zona_ind_012.jpg
drwxrwx--x system   system            2010-08-05 16:16 app
drwxr-x--- root     log               2010-08-05 15:32 dontpanic
drwxrwx--x system   system            2010-08-05 16:25 dalvik-cache
drwxrwxr-x system   system            2010-08-05 17:16 system
drwxrwx--- root     root              2010-08-05 15:32 lost+found
</code></pre>
