get Rom Available Size - Android android.os

Android examples for android.os:StatFs

Description

get Rom Available Size

Demo Code

import android.graphics.BitmapFactory;
import android.graphics.drawable.Drawable;
import android.lemon.assist.Check;
import android.lemon.config.BaseConfig;
import android.os.Environment;
import android.os.StatFs;
import java.io.File;
import java.io.FileReader;
import java.io.IOException;
import java.util.Comparator;

public class Main{

    public static long getRomAvailableSize() {
        File path = Environment.getDataDirectory();
        StatFs stat = new StatFs(path.getPath());
        long blockSize = stat.getBlockSize();
        long availableBlocks = stat.getAvailableBlocks();
        return blockSize * availableBlocks;
    }//from w ww .j  a  v  a  2s . c om

}

Related Tutorials