1. Check out our app, Forums for Android! Download and leave feedback here!

Unable to enumerate files

Discussion in 'Application Development' started by jacks sparrow, Sep 20, 2010.

  1. jacks sparrow

    jacks sparrow New Member
    Thread Starter
    5

    Sep 17, 2010
    3
    0
    5
    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
    53

    Aug 12, 2010
    313
    51
    53
    Norway
    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
    Thread Starter
    5

    Sep 17, 2010
    3
    0
    5
    Thanx for reply miXer.

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

    miXer Well-Known Member
    53

    Aug 12, 2010
    313
    51
    53
    Norway

Share This Page

Loading...