I want to check the free size available on My Device's SD Card. I know FileConnection API. How can I check the free size of the SD Card ?
SD Card's Free Size
702 views Asked by Lucifer At
1
I want to check the free size available on My Device's SD Card. I know FileConnection API. How can I check the free size of the SD Card ?
The idea is to open the cfcard file connection and call
availableSize()on it. to get the proper memory card location read it from theSystem.getProperty(...). In some devices the aforesaid property may fail hence constructing new path from the memory card name system property.NOTE: In certain devices the hostname must be 'localhost', hence change the return string in getFilehost() appropriately.
PS: Since this is a code snippet certain form / command references may throw null pointer please resolve it accordingly.
Below code with get you the available size in 'BYTES' of the memory card
Supporting methods