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
Regular Contributor
heather_1
Posts: 83
Registered: ‎05-24-2011
My Device: Storm 9550

app not running with sdcard

I am trying to debug my app on a device, and previously, the app was running correctly, however, now I get a nullpointerexception when I try to access the sqlite database that is on the SDCard. I get this error exactly:

 

The exception is net.rim.device.api.database.DatabasePathException: Invalid path name. Path does not contains a proper root list. See FileSystemRegistry class for details.


 

The path was working fine earlier. Any ideas?

Regular Contributor
heather_1
Posts: 83
Registered: ‎05-24-2011
My Device: Storm 9550

Re: app not running with sdcard

Here is my path:

String DB_NAME = "localdatabase.sql";

String dbLocation = "/SDCard/databases/CreativeCore/";
               
                // Create URI           
                URI uri = URI.create(dbLocation + DB_NAME);    
               
                System.out.println("uri is created");

 After this is a long try/catch where I try to open the database, but the databasepathexception is getting caught...

Developer
peter_strange
Posts: 19,610
Registered: ‎07-14-2008
My Device: Not Specified

Re: app not running with sdcard

Can you see the SDCard when you use the Media 'Explorer'.  Start the Media and press the menu, select "Explorer".

 

You might find this code from the SQL Demo, usefUL:

            boolean sdCardPresent = false;
            String root = null;
            Enumeration e = FileSystemRegistry.listRoots();
            while (e.hasMoreElements())
            {
                root = (String)e.nextElement();
                if(root.equalsIgnoreCase("sdcard/"))
                {
                    sdCardPresent = true;
                }    
            }   

 

 

Perhaps you have connected the BB to a PC and the SD Card is now in mass storage mode?  Or perhaps the SD Card has dies?