Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How access existing sqlite database on Android Emulator?

So im new to working with databases in android, and I cant seem to figure out how to view a created database.

I created the database adapter class and in my main activity class.

I run it in the emulator with no issues, but how do I view the contents? The book im reading says "examine the file system of the Android device/emulator using DDMS. The database is created under the database folder" and has an image of the database under a database folder in Eclipse. I dont know what the first part really means (using DDMS?) and have no idea where the /data/data folder is that people mention.

Even running SQLite3 in CMD and typing ".tables" doesn't yield any database.

like image 630
Rob Avatar asked Aug 09 '11 19:08

Rob


1 Answers

In Eclipse Go to Window > Open Persepective > Other > DDMS. Navigate to the DB like the image from the answer below, select the database then click on the floppydisk icon to pull the file from the device on the top right.

In the emulator, the location in DDMS should be /data/data/com.yourNamespace/databases in the File Explorer tab.

enter image description here This is a pic of the DDMS perspective. In the File Explorer tab on the right, you would drill down to the databases folder. These are virtual folders, so you won't find them on your system. To examine the db, you would select the icon for Pull file from the device (sorry, it got cropped out in this screenshot) and open that file in SQLite.

like image 104
adamcodes Avatar answered Oct 13 '22 18:10

adamcodes