Reputation: 2182
My application need to download some files to cache. but i wanted to check if the user have SDcard installed so i can save files there instead of the device memory. i used this code :
String SDexist = "file:///SDCard/";
fconnSD = (FileConnection) Connector.open(SDexist,Connector.READ);
if(!fconnSD.exists())
{
FileDire = "file:///store/home/user/catch/";
} else
{
FileDire = "file:///SDCard/BlackBerry/catch/";
}
but it's not working, it allways looks for SD card and not saving files in device memory even if the SD card is not available. Any ideas?
Upvotes: 2
Views: 397
Reputation: 2182
Solved, i used FileSystemRegistry.listRoots();
And read root elemnts, if sdcard exsits then the SD card should be installed.
Upvotes: 4