android - available space in sd card and internal memory -


I want to get the available space in the SD card and internal memory

I used the following code Available space in internal storage

  StatFs stat = new StatFs (Environment.getExternalStorageDirectory.). GetPath ()); Double sdAvailSize = (double) stat.getAvailableBlocks () * (double) stat.getBlockSize (); // A binary gigabyte equal to 1,073,741,824 bytes Double Giga Available = sdAvailSize / 1073741824;  

But by any means I can get the available space in the SD card, I know that I can not use the SD card on kit-ket, but if I'm jelly beans I use it anyway, I can access the SD card available location

Device 4.1.2

There is no way to know the path of external SD card on pre-KitKat devices, API only in KitKat is available. You can use various hacks to estimate the SD card path, for example

read as described / proc / mounts

Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -