get File Names in Asset Folder - Android App

Android examples for App:Assets File

Description

get File Names in Asset Folder

Demo Code


//package com.java2s;
import android.content.res.AssetManager;

import java.io.File;
import java.io.IOException;

public class Main {
    public static String MainPath = "smsfaces";

    public static String[] getFileNamesinFolder(AssetManager mgr,
            String folder) {/*from  www . j  a  v  a 2  s .c o  m*/
        String[] fileNames;
        try {
            fileNames = mgr.list(MainPath + File.separator + folder);
            return fileNames;

        } catch (IOException e) {
            e.printStackTrace();
            return new String[0];//To change body of catch statement use File | Settings | File Templates.
        }
    }
}

Related Tutorials