public static boolean hasEnoughSpace(String recordingSdcard){
  boolean ret=false;
  try {
    StatFs fs=new StatFs(recordingSdcard);
    long blocks=fs.getAvailableBlocks();
    long blockSize=fs.getBlockSize();
    long spaceLeft=blocks * blockSize;
    Log.d(TAG,"hasEnoughSpace: available space=" + spaceLeft);
    ret=spaceLeft > LOW_SPACE_THRESHOLD ? true : false;
  }
 catch (  IllegalArgumentException e) {
    Log.e(TAG,"sdcard may be unmounted:" + recordingSdcard);
  }
  return ret;
}

public static boolean hasEnoughSpace ( String recordingSdcard ) { boolean ret = false ; try { StatFs fs = new StatFs ( recordingSdcard ) ; long blocks = fs . getAvailableBlocks ( ) ; long blockSize = fs . getBlockSize ( ) ; long spaceLeft = blocks * blockSize ; Log . d ( TAG , "hasEnoughSpace: available space=" + spaceLeft ) ; ret = spaceLeft > LOW_SPACE_THRESHOLD ? true : false ; } catch ( IllegalArgumentException e ) { Log . e ( TAG , "sdcard may be unmounted:" + recordingSdcard ) ; } return ret ; }
check if has enough space for record
