Example usage for android.os StatFs getFreeBlocks

List of usage examples for android.os StatFs getFreeBlocks

Introduction

In this page you can find the example usage for android.os StatFs getFreeBlocks.

Prototype

@Deprecated
public int getFreeBlocks() 

Source Link

Usage

From source file:org.ormma.controller.OrmmaAssetController.java

/**
 * Cache remaining./*from ww w .  ja va  2s . c o m*/
 * 
 * @return the cache remaining
 */
public int cacheRemaining() {
    File filesDir = mContext.getFilesDir();
    StatFs stats = new StatFs(filesDir.getPath());
    int free = stats.getFreeBlocks() * stats.getBlockSize();
    return free;
}

From source file:org.mozilla.gecko.GeckoAppShell.java

public static long getFreeSpace() {
    try {//from   w  ww  .j a  va2s  .c  om
        if (sFreeSpace == -1) {
            File cacheDir = getCacheDir();
            if (cacheDir != null) {
                StatFs cacheStats = new StatFs(cacheDir.getPath());
                sFreeSpace = cacheStats.getFreeBlocks() * cacheStats.getBlockSize();
            } else {
                Log.i(LOGTAG, "Unable to get cache dir");
            }
        }
    } catch (Exception e) {
        Log.e(LOGTAG, "exception while stating cache dir: ", e);
    }
    return sFreeSpace;
}