Android examples for android.os:Disk
get Available Internal Storage
import android.content.Context; import android.os.Build; import android.os.Environment; import android.os.StatFs; import java.io.File; public class Main{ public static long getAvailableInternalStorage() { File file = Environment.getDataDirectory(); if (file != null && file.exists()) { StatFs sdFs = new StatFs(file.getPath()); if (sdFs != null) { long sdBlockSize = sdFs.getBlockSize(); long sdAvailCount = sdFs.getAvailableBlocks(); return sdAvailCount * sdBlockSize; }/*w ww. jav a 2s . c o m*/ } return 0; } }