Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
import java.io.File;

import java.util.ArrayList;

import java.util.List;

import android.content.Context;

public class Main {
    public static List<File> getFiles(Context context, String ext) {
        File dir = context.getFilesDir();
        final List<File> files = new ArrayList<File>();
        File[] subFiles = dir.listFiles();
        if (subFiles != null) {
            for (File file : subFiles) {
                if (file.isFile() && file.getName().endsWith(ext)) {
                    files.add(file);
                }
            }
        }
        return files;
    }
}