Monday, 13 January 2014


Check internal memory space in android.The following code will return free space of internal memory.

StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath());
long bytesAvailable = (long) stat.getBlockSize() * (long) stat.getAvailableBlocks();
long megAvailable = bytesAvailable / (1024 * 1024);

StatFs usefull link: http://developer.android.com/reference/android/os/StatFs.html

Variable megAvailable will return the free memory space of internal memory.

Thanks.

No comments:

Post a Comment