Android SDCard Size Get getUsableSpace(File path)

Here you can find the source of getUsableSpace(File path)

Description

get Usable Space

Declaration

public static long getUsableSpace(File path) 

Method Source Code

//package com.java2s;
import java.io.File;

import android.os.StatFs;
import android.util.Log;

public class Main {
    private static final String TAG = "BitmapCommonUtils";

    public static long getUsableSpace(File path) {
        try {// www .  j  ava  2s.co  m
            final StatFs stats = new StatFs(path.getPath());
            return (long) stats.getBlockSize()
                    * (long) stats.getAvailableBlocks();
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }

    }
}

Related

  1. getSDPath()
  2. getMounts(CharSequence path)
  3. getMounts(CharSequence path)
  4. getAvailableMb(String path)
  5. getUsableSpace(File path)