Android examples for android.os:Memory
get Available Internal Memory Size
import android.os.Environment; import android.os.StatFs; public class Main { public static long getAvailableInternalMemorySize() { long availableSpace = -1l; try {/*from w w w .j a v a 2s. c o m*/ String path = Environment.getDataDirectory().getPath(); StatFs stat = new StatFs(path); long blockSize = stat.getBlockSize(); long availableBlocks = stat.getAvailableBlocks(); availableSpace = availableBlocks * blockSize; } catch (Exception e) { } return availableSpace; } }