I am tinkering around with a code that accesses a prepopulated database. I am running into a nullPointerException error and I cant figure out whats going on. I am going to post my code and if anyone could help I would greatly appreciate it.

1 Answer
1

First, you're getting the error in fetchNote(). In the stack trace, the 5th line from the bottom shows this. You can use the line number at the end to get close to where it's happening.

My guess is that the query is failing.

My further guess is that it's because you're trying to "restore" a database by copying it byte-for-byte from someplace else. I'm not convinced that this will work. The best way to provide a prepopulated database in an app is to put its data in a flat file and then, when the app is first run, create the database and write the data into it.

In the Developers Guide, the source file DictionaryDatabase.java in the sample app SearchableDictionary gives example code for this.