Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
Developer
Posts: 77
Registered: ‎11-20-2008
My Device: Not Specified
Accepted Solution

Way to figure out how big inserted SD card is?

Has anyone found a way to discover details about the SD card? Specifically:

 

A) If an SD card is available/inserted.  (SDCardInfo.isAvailable())

B) What the capacity of the card is if inserted (SDCardInfo.getSize())

C) How much space is left on the SD card. (SDCardInfo.getRemaininRoom())

 

Thanks in advance.

Developer
Posts: 163
Registered: ‎07-16-2008
My Device: Not Specified
My Carrier: Sprint

Re: Way to figure out how big inserted SD card is?

You'll want to look at FileConnection and FileSystemRegistry.

 

You can use FileSystemRegistry.listRoots() to get a list of all of the root directories you can write to - You're looking for one that has "sdcard/" in it.

 

Then you can use a fileconnection on that root directory, and call the methods "availableSize", "totalSize", and "usedSize" - Those should give you what you're looking for.

Andrew Cowart | Metova
www.metova.com
Highlighted
Developer
Posts: 77
Registered: ‎11-20-2008
My Device: Not Specified

Re: Way to figure out how big inserted SD card is?

Thanks Andrew, that works.