To inspect your sqlite database you need to be able to access it.
For some devices you can use "adb shell" to login into your device and then use unix
commands to move to your database. For me that was
cd /data/data/edu.byu.cs240.bookclub/databases"
On some devices, such as the emulators, you can go step by step (i.e. cd data then cd data then
cd edu.byu.cs240.bookclub then cd databases) to get to the database directory. Once
there, you can use sqlite3 from the command line (if sqlite3 is installed on your device) to
access the database, in my case I typed:
sqlite3 bookclub.sqlite
If the latter doesn't work (which it doesn't on my Kindle Fire), the first thing I type after
logging into my device's shell is type "run-as" project's full name. In my case it is:
run-as edu.byu.cs240.bookclub
This should take you to the root directory of your project. There you should find a directory
named "databases". Use cd to go into this directory. There you should find a file containing
your database. My file was called "bookclub.sqlite". If sqlite3 is installed on your device
then you can use it to access and view your database.
However, sqlite3 may not be installed on your device. In that case you must copy your database
file from your device to your pc to inspect it using sqlite3 or using the android manager
plugin you can install in firefox. To copy a file from your device first you have to have
read permissions on the file to be copied. There are many ways to do this. I used "adb shell"
to get to my device's command line. The I used the the "run-as" command as explained above
to get to my root directory. Then I used "cd databases" to get to the database directory.
Once there I used "chmod" to change the ownership permissions. For example:
chmod 666 bookclub.sqlite
Then I went back to my unix machine and moved to the directory where I wanted to copy the file.
There I typed the following:
adb exec-out run-as edu.byu.cs240.bookclub cat databases/$1.sqlite > $1.sqlite
replacing both "$1" strings with you database name. In my case I typed
adb exec-out run-as edu.byu.cs240.bookclub cat databases/bookclub.sqlite > bookclub.sqlite
The following is a link to a shell script you can use. Just copy it to your target directory.
Use chmod to made it executable (chmod 755 copydb). Then type
copydb bookclub.sqlite
and it should copy your database to the current directory.
Here is a link to the script file: copydb