Android SDCard Check getRealSizeOnSdcard()

Here you can find the source of getRealSizeOnSdcard()

Description

get Real Size On Sdcard

License

Apache License

Declaration

public static long getRealSizeOnSdcard() 

Method Source Code

//package com.java2s;
//License from project: Apache License 

import java.io.File;

import android.os.Environment;
import android.os.StatFs;

public class Main {
    public static long getRealSizeOnSdcard() {
        File path = new File(Environment.getExternalStorageDirectory()
                .getAbsolutePath());//from   www  . j  a  v a2s .  c om
        StatFs stat = new StatFs(path.getPath());
        long blockSize = stat.getBlockSize();
        long availableBlocks = stat.getAvailableBlocks();
        return availableBlocks * blockSize;
    }
}

Related

  1. enoughSpaceOnPhone(long updateSize)
  2. enoughSpaceOnSdCard(long updateSize)
  3. getRealSizeOnPhone()
  4. hasExternalCacheDir()
  5. hasSDCard()
  6. hasSDCard()
  7. sdCardIsAvailable()