Here you can find the source of enoughSpaceOnSdCard(long updateSize)
public static boolean enoughSpaceOnSdCard(long updateSize)
//package com.java2s; //License from project: Apache License import java.io.File; import android.os.Environment; import android.os.StatFs; public class Main { public static boolean enoughSpaceOnSdCard(long updateSize) { String status = Environment.getExternalStorageState(); if (!status.equals(Environment.MEDIA_MOUNTED)) return false; return (updateSize < getRealSizeOnSdcard()); }// www . j ava2s . c o m public static long getRealSizeOnSdcard() { File path = new File(Environment.getExternalStorageDirectory() .getAbsolutePath()); StatFs stat = new StatFs(path.getPath()); long blockSize = stat.getBlockSize(); long availableBlocks = stat.getAvailableBlocks(); return availableBlocks * blockSize; } }