Android SDCard Size Get getAvailableMb(String path)

Here you can find the source of getAvailableMb(String path)

Description

get Available Mb

Declaration

public static long getAvailableMb(String path) 

Method Source Code

//package com.java2s;

import android.os.StatFs;

public class Main {
    public static long getAvailableMb(String path) {
        final long SIZE_KB = 1024L;
        final long SIZE_MB = SIZE_KB * SIZE_KB;
        long availableSpace = -1L;
        StatFs stat = new StatFs(path);
        availableSpace = (long) stat.getAvailableBlocks()
                * (long) stat.getBlockSize();

        return availableSpace / SIZE_MB;
    }//from   www .ja va2  s .c  o  m
}

Related

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