Code example for StatFs

Methods: getAvailableBlocks, getBlockSize

0
	static class GetUsableSpaceAccessor { 
 
		@TargetApi(Build.VERSION_CODES.GINGERBREAD)
		public static long getUsableSpace(final File path) {
			if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) return path.getUsableSpace();
			final StatFs stats = new StatFs(path.getPath());
			return (long) stats.getBlockSize() * (long) stats.getAvailableBlocks();
		} 
	} 
}