Q:

Android: Empty assets folder containing files

I have been searching around this website for quite a while now trying to find an answer to this, but I just can't get it.
What I am trying to get is a list of files in the assets folder. This is because I want to have a smart way of loading those files and using them in different screens without having to write a serparate activity for every single file in the folder. This is the code I'm currently using.
File file = new File("file:///android_asset/Peacefulpack.txt");
Log.e("Test", file.getName());

File folder = new File("file:///android_asset");
for(int i = 0; i < folder.listFiles().length; i++)
{
    Log.e("Test", folder.listFiles()[i].getName());
}

The top part of the code with file works just fine, but the one with folder doesn't. The strange thing is that folder.listFiles() returns null, but it should only do so when there are no files or subfolders in the directory (at least as far as I know). However, there are files in this folder since I'm accesing one in there.
Why is this giving me a null pointer?

A:

try this:
String folder = "/";
AssetManager am = getResources().getAssets();
String fileList[] = am.list(folder);
for(int i = 0; i < fileList.length; i++)
{
    Log.e("Test", fileList[i]);
}

