Hi,
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.
Example : /data/1.jpg
Now I create a File object with the directory path as input and call listFiles api.
File dir = new File(dirPath);
File[] filelist = dir.listFiles();
But the fileList does not contain the image file(1.jpg).
But strangely, If I create a ImageView with hardcoded path "/data/1.jpg", I could see the image getting drawn.
Can some one help me.... where could be the problem
Thanks, Kowndinya
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<fileList.length;i++)
{
_namelist.addElement(fileList[i].getName());
_pathlist.addElement(fileList[i].getAbsolutePath());
}
}
notifyDataSetChanged();
return 0;
}
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.
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