Java tutorial
//package com.java2s; import java.io.File; import android.os.Environment; public class Main { public static final boolean deleteFile(String path) { if (storageReady()) { File f = new File(path); return f.delete(); } else { return false; } } public static boolean storageReady() { String cardstatus = Environment.getExternalStorageState(); if (cardstatus.equals(Environment.MEDIA_REMOVED) || cardstatus.equals(Environment.MEDIA_UNMOUNTABLE) || cardstatus.equals(Environment.MEDIA_UNMOUNTED) || cardstatus.equals(Environment.MEDIA_MOUNTED_READ_ONLY)) { return false; } else { return true; } } }