AndroidでRomサイズを取得

Javaコード:
public long[] getRomMemroy() {
long[] romInfo = new long[2];
//総ROMメモリ
romInfo[0] = getTotalInternalMemorySize();

//利用可能なROMメモリ
File path = Environment.getDataDirectory();
StatFs stat = new StatFs(path.getPath());
long blockSize = stat.getBlockSize();
long availableBlocks = stat.getAvailableBlocks();
romInfo[1] = blockSize * availableBlocks;
getVersion();
return romInfo;
}

public long getTotalInternalMemorySize() {
File path = Environment.getDataDirectory();
StatFs stat = new StatFs(path.getPath());
long blockSize = stat.getBlockSize();
long totalBlocks = stat.getBlockCount();
return totalBlocks * blockSize;
}

Android

Posted by arkgame