Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

import java.io.File;
import android.os.Environment;
import android.os.StatFs;

public class Main {
    @SuppressWarnings("deprecation")
    public static long getAvailableSD() {
        File path = Environment.getExternalStorageDirectory();
        StatFs statFs = new StatFs(path.getPath());
        long blockSize = statFs.getBlockSize();
        long blockCount = statFs.getBlockCount();
        long availableBlocks = statFs.getAvailableBlocks();
        return availableBlocks * blockSize;
    }
}