Java tutorial
//package com.java2s; import java.io.File; public class Main { public static boolean findPhotoFromSDCard(String path, String photoName) { boolean flag = false; if (checkSDCardAvailable()) { File dir = new File(path); if (dir.exists()) { File folders = new File(path); File photoFile[] = folders.listFiles(); for (int i = 0; i < photoFile.length; i++) { String fileName = photoFile[i].getName().split("\\.")[0]; if (fileName.equals(photoName)) { flag = true; } } } else { flag = false; } } else { flag = false; } return flag; } public static boolean checkSDCardAvailable() { return android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED); } }