Friday, January 13, 2012

How to View Your Android App Database: SQLite Database Broswer

I've been using SQLite Database Browser to look through my android database and make changes. Linky link:
http://sourceforge.net/projects/sqlitebrowser/

You can pull your application's database off the emulator as a .sql file and open it up in this browser to see all that fancy sql stuff. 

To get your database off the emulator:

First, you have to have eclipse open and running, and run your application in your emulator of choice. 

Once the app is up and running, go back to eclipse and select Window > Open Perspective > DDMS

Under the Devices tab: Make sure the emulator that is running your app is highlighted/selected. Navigate to the "File Explorer" tab. (If it's not available, select Window > Show View > File Explorer.)

In the File Explorer tab: (1) open the "data" folder, (2) open a second "data" folder, (3) find and open the folder with "your application's name", (4) find and open the "databases" folder, (5) select the file with your application's name

In the upper right of the File Explorer frame, there is a button with an image of a floppy disk with an arrow. Click on the one that says "Pull a file from device" and save your database file somewhere memorable. It might automatically save it to your project's location on your hard drive. 

Now you can view it and play around with it in SQLite Database Browser :)

Keep in mind that you have to upload the new database onto the phone or emulator before the changes can be accessed by your app.


No comments:

Post a Comment