Show files in a directory in Assets folder in Android

For testing purpose, this code snippet can be run in the onCreate method of an Activity class. It will print all the file names you have in the data folder inside your assets folder. app/assets/data/

//list files in a folder in asset
AssetManager assetManager = getAssets();
try {
    String[] files = assetManager.list("data");

    for(int i=0; i<files.length; i++){
        Log.d("TestActivity", files[i]);
} catch (IOException e1) {
    // TODO Auto-generated catch block

Search within Codexpedia

Custom Search

Search the entire web

Custom Search