Unable to enumerate files


Last Updated: 2010-09-21 17:56:50
  1. jacks sparrow

    jacks sparrow New Member

    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());

    }



    Thanks.

    Advertisement
  2. miXer

    miXer Well-Known Member

    Only root has access to the /Data folder. If you want access to it, you have to root your phone.
  3. jacks sparrow

    jacks sparrow New Member

    Thanx for reply miXer.

    Will u please suggest me that how to root the phone?
  4. miXer

    miXer Well-Known Member

Share This Page