Search This Blog

Tuesday, 22 May 2012

How to check if SdCard is supported and present in Blackberry

Hello friends,
                    Here is the simple one to get the info if SDCard is supported and present in the device or not , Follow below code:

CODE:
boolean _sdcardStatus = false;

String _modelNum = DeviceInfo.getDeviceName();
        if((_modelNum.startsWith("8")&& !_modelNum.startsWith("87"))|| _modelNum.startsWith("9")){
            String root = null;
            Enumeration e = FileSystemRegistry.listRoots();
            while(e.hasMoreElements()){
                root = (String)e.nextElement();
                if(root.equalsIgnoreCase("sdcard/")){
                    _sdcardStatus = true;
                }
            }
        }

_sdcardStatus variable returns true in case SD Card is supported and present in device otherwise it returns false;

No comments:

Post a Comment