Display contents of a Directory Android
<p>I am trying to display the contents of /data/dalvik-cache through the following program but it returns a NULL pointer exception. After a bit googling i found out that i don't have permissions to read the contents of /data folder.My phone is rooted and is there a way to display the contents of all such folders whose permissions are limited?</p>

<pre><code>public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        File listfiles[] = null;
        final String s = "/data/dalvik-cache";

        File aDirectory = new File("/mnt");

        if(aDirectory.isDirectory())
            listfiles = aDirectory.listFiles();

        for(int i=0;i&lt;listfiles.length;i++)
            Log.i("FileName", listfiles[i].getName());

    }
</code></pre>
