Java tutorial
//package com.java2s; import android.os.Environment; import java.io.File; public class Main { public static final String STORAGE_PATH = Environment.getExternalStorageDirectory() + "/DCIM/MyCamera/"; public static int getFileLength() { File fileDir = getFilesDirectory(STORAGE_PATH); if (!fileDir.exists()) { if (!fileDir.mkdirs()) { return 0; } } File[] files = fileDir.listFiles(); return files.length; } public static File getFilesDirectory(String storage_path) { storage_path = STORAGE_PATH; File filesDirectory = new File(storage_path); return filesDirectory; } }