I'm new to Android. I need the simple code of getting the Internal storage and external storage and System storage and how to get the Details of available memory(internal and external) space, total memory space. My code is below but its getting error in "StatFs" method. Thanks in advance.
long total, aval,total1, aval1,total2, aval2;
int kb = 1024;
StatFs fs = new StatFs(Environment.
getExternalStorageDirectory().getPath());
total = fs.getBlockCount() * (fs.getBlockSize() / kb);
aval = fs.getAvailableBlocks() * (fs.getBlockSize() / kb);
//Here Iam Getting error StatFs method not loading
StatFs fs1 = new StatFs(Environment.
getRootDirectory()+"/storage/extSdCard/");
total1 = fs1.getBlockCount() * (fs1.getBlockSize() / kb);
aval1 = fs1.getAvailableBlocks() * (fs1.getBlockSize() / kb);
pb1.setMax((int)total);
pb1.setProgress((int)aval);
pb2.setMax((int)total1);
pb2.setProgress((int)aval1);
}