How to find the amount of free storage (disk space) left on Android?
Try StatFs.getAvailableBlocks. You'll need to convert the block count to KB with getBlockSize.
Correct way to check disk space available for Android app?
Well if you have the path I believe your answer can be found inside How to find the amount of free storage (disk space) left on Android?, check the code samples there.
Android get free size of internal/external memory
This is the way I did it :
StatFs stat = new StatFs(Environment.getExternalStorageDirectory().getPath());
long bytesAvailable;
if (android.os.Build.VERSION.SDK_INT >=
android.os.Build.VERSION_CODES.JELLY_BEAN_MR2) {
bytesAvailable = stat.getBlockSizeLong() * stat.getAvailableBlocksLong();
}
else {
bytesAvailable = (long)stat.getBlockSize() * (long)stat.getAvailableBlocks();
}
long megAvailable = bytesAvailable / (1024 * 1024);
Log.e("","Available MB : "+megAvailable);
Get free space on internal memory
this post might fit well to your question.
also check this thread. there is so much info here on SO.
googled a bit and here is the solution (found at android git)
File path = Environment.getDataDirectory();
StatFs stat = new StatFs(path.getPath());
long blockSize = stat.getBlockSize();
long availableBlocks = stat.getAvailableBlocks();
return Formatter.formatFileSize(this, availableBlocks * blockSize);
Related Topics
How to Bypass The Firebase Cache to Refresh Data (In Android App)
Install_Failed_Cpu_Abi_Incompatible on Device Using Intellij
How to Take Pictures from The Camera Without Preview When My App Starts
Evenly Spaced Menu Items on Toolbar
How to Hide The System/Navigation Bar in Android Ics
How to Import an Existing Project from Github into Android Studio
How to Run The Same Asynctask More Than Once
Get Signal Strength in Android
How to Open Specific Contact Chat Screen in Various Popular Chat/Social-Networks Apps
Android: Runonuithread Vs Asynctask
How to Set Android Tablayout in The Bottom of The Screen
What Would Happen If Android App Is Released with Debuggable On
Items Inside Gridview Getting Repeated When Screen Scrolls
Is Google-Services.JSON Safe from Hackers