Android Context Get getFiles(Context context, String ext)

Here you can find the source of getFiles(Context context, String ext)

Description

get Files

Declaration

public static List<File> getFiles(Context context, String ext) 

Method Source Code

//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);/*from   w ww . j a v  a 2s. c  o  m*/
                }
            }
        }
        return files;
    }
}

Related

  1. getEditor( Context ctx)
  2. getExternalCacheDir(Context context)
  3. getExternalCacheDir(Context context)
  4. getExternalCacheDir(Context context)
  5. getFAFont(Context context)
  6. getFromAssets(Context con, String fileName)
  7. getHelpUrl(Context context, String s)
  8. getImei(Context context, String imei)
  9. getInstalleApps(Context mContext)