Android SDCard Check getExternalStorageTotalSize()

Here you can find the source of getExternalStorageTotalSize()

Description

Obtain SD card total size.

Return

byte unit of SD card total size.

Declaration

public static long getExternalStorageTotalSize() 

Method Source Code

//package com.java2s;

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

public class Main {
    /**//from  w w w.jav a  2s  . c  o m
     * Obtain SD card total size.
     * 
     * @return byte unit of SD card total size.
     * @author Sean Zheng
     * @CreateDate 2013-4-23
     */
    public static long getExternalStorageTotalSize() {
        final StatFs statfs = new StatFs(Environment
                .getExternalStorageDirectory().getAbsolutePath());
        final long blockCount = statfs.getBlockCount();
        final long blockSize = statfs.getBlockSize();
        return blockCount * blockSize;
    }
}

Related

  1. sdCardIsAvailable()
  2. isExternalStorageReadable()
  3. isExternalStorageWritable()
  4. hasMountSDCard()
  5. getExternalStorageFreeSize()
  6. generateLogOnSD(String sBody, String fileName, String folderName)
  7. getDataFilesDir(Context c)
  8. getSDPath()
  9. getSdCacheDir(Context context)