Android examples for Hardware:SD Card
has Enough Space from External Storage Directory
//package com.java2s; import android.os.Environment; import android.os.StatFs; public class Main { public static boolean hasEnoughSpace(long threshold) { return getAvailableSpace() >= threshold; }//from w w w . j av a 2 s . com @SuppressWarnings("deprecation") public static long getAvailableSpace() { String sdcard = Environment.getExternalStorageDirectory() .toString(); long space = 0; try { StatFs stat = new StatFs(sdcard); space = ((long) stat.getAvailableBlocks() * (long) stat .getBlockSize()); } catch (Exception e) { e.printStackTrace(); } return space; } }