Java tutorial
//package com.java2s; // Use of this source code is governed by a BSD-style license that can be import android.os.StatFs; public class Main { @SuppressWarnings("deprecation") private static long getSize(StatFs statFs) { int blockSize = statFs.getBlockSize(); int availableBlocks = statFs.getAvailableBlocks(); return (blockSize * availableBlocks) / (1024 * 1024); } }