Java tutorial
//package com.java2s; import java.io.File; import android.content.Context; import android.os.Environment; public class Main { private static final String FILE_DIR = "/temp"; public static boolean hasSDCard(Context context) { if (android.os.Environment.getExternalStorageState().equals(android.os.Environment.MEDIA_MOUNTED)) { String dir = Environment.getExternalStorageDirectory() + FILE_DIR; File f = new File(dir); if (!f.exists()) { f.mkdir(); } else { try { for (File t : f.listFiles()) { t.delete(); } } catch (Exception e) { e.printStackTrace(); } } return true; } return false; } }