List of usage examples for android.os StatFs getBlockSizeLong
public long getBlockSizeLong()
From source file:com.colorchen.qbase.utils.FileUtil.java
/** * ?SD?//from w w w. j ava 2s . c om * * @return SD? */ @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) public static String getFreeSpace() { if (!isSDCardEnable()) { return "sdcard unable!"; } StatFs stat = new StatFs(getSDCardPath()); long blockSize, availableBlocks; availableBlocks = stat.getAvailableBlocksLong(); blockSize = stat.getBlockSizeLong(); return DataUtil.byte2FitSize(availableBlocks * blockSize); }
From source file:com.miz.functions.MizLib.java
@SuppressWarnings("deprecation") public static long getFreeMemory() { StatFs stat = new StatFs(Environment.getDataDirectory().getPath()); if (hasJellyBeanMR2()) return stat.getAvailableBlocksLong() * stat.getBlockSizeLong(); else/*from ww w.ja va2s. c o m*/ return stat.getAvailableBlocks() * stat.getBlockSize(); }