I was wondering how I can get the information about any memory card, internal storage that an android device have! what I want is the free, used memory amount and if possible the extra details about memory card! ( not the internal Storage )

有帮助吗?

解决方案

This will help you to get free memory of external storage:

StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath());
long bytesAvailable = (long)stat.getBlockSize() * (long)stat.getAvailableBlocks();
long megAvailable = bytesAvailable / (1024 * 1024);
Log.d("","Available MB : "+megAvailable);

Hope this will help you.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top