How do you check if the SD card is full or not so that your application can decide if it can continue to do its job i.e. write to external storage or notify the user that st
/**
* @return Number of bytes available on external storage
*/
public static long getExternalStorageAvailableSpace() {
long availableSpace = -1L;
try {
StatFs stat = new StatFs(Environment.getExternalStorageDirectory()
.getPath());
stat.restat(Environment.getExternalStorageDirectory().getPath());
availableSpace = (long) stat.getAvailableBlocks() * (long) stat.getBlockSize();
} catch (Exception e) {
e.printStackTrace();
}
return availableSpace;
}