• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Unable to enumerate files

Hello,

I am newbie in Android world. I have created simple application which enumerates the files in the android device. In the my emulator (file explorer) there is folder named "Data". I unable to enumerate this folder. I simply called listFiles() method.

Following is the code. It is showing logs as listFiles failed. But when I tried to get the files under the /data/anr folder, I am getting it.

I didn't understood such behaviour.


String m_file_test = "/data";


File m_file_list[] = m_file_test.listFiles();
if (null == m_file_list)
{
Log.i("Fail", "listFiles failed");
return;
}

int iTotal = m_file_list.length;

for (iCnt = 0; iCnt < iTotal; ++iCnt)
{
Log.i("File Found = ", m_file_list[iCnt].getAbsolutePath());

}
 

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones